From 3cf234d49e3f9cac6586f4df30356be0cf2aa0a3 Mon Sep 17 00:00:00 2001 From: lovvvve Date: Thu, 28 Jan 2021 16:57:20 +0800 Subject: [PATCH] Update value.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit value type 是 int 或 float 时 value 值等于 0 是会删除 的 BUG --- cmdb-api/api/lib/cmdb/value.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdb-api/api/lib/cmdb/value.py b/cmdb-api/api/lib/cmdb/value.py index 4976e8f..10c54a0 100644 --- a/cmdb-api/api/lib/cmdb/value.py +++ b/cmdb-api/api/lib/cmdb/value.py @@ -161,7 +161,7 @@ class AttributeValueManager(object): self._write_change(ci.id, attr.id, OperateType.ADD, None, value) else: if existed_value != value: - if value == 0 and not value and attr.value_type != ValueTypeEnum.TEXT: + if value != 0 and not value and attr.value_type != ValueTypeEnum.TEXT: existed_attr.delete() else: existed_attr.update(value=value)