mirror of https://github.com/veops/cmdb.git
Update value.py
feat(AttributeValueManager.create_or_update_attr_value()): AttributeValue update skip The same value
This commit is contained in:
parent
e6d3c34f75
commit
889d9155bc
|
@ -160,12 +160,13 @@ class AttributeValueManager(object):
|
|||
|
||||
self._write_change(ci.id, attr.id, OperateType.ADD, None, value)
|
||||
else:
|
||||
if not value and attr.value_type != ValueTypeEnum.TEXT:
|
||||
if existed_value != value:
|
||||
if value is not 0 and not value and attr.value_type != ValueTypeEnum.TEXT:
|
||||
existed_attr.delete()
|
||||
else:
|
||||
existed_attr.update(value=value)
|
||||
|
||||
self._write_change(ci.id, attr.id, OperateType.UPDATE, existed_value, value)
|
||||
AttributeValueManager._write_change(ci.id, attr.id, OperateType.UPDATE, existed_value, value)
|
||||
|
||||
@staticmethod
|
||||
def delete_attr_value(attr_id, ci_id):
|
||||
|
|
Loading…
Reference in New Issue