[FIX] base: do not unlink() to remove ir.property records (#21269)

Unlinking such a record causes a cache invalidation, that drops the values of
other company-dependent fields to set.  This may cause other company-dependent
fields to be set to their former value.

OPW 782080
This commit is contained in:
Raphael Collet
2017-12-07 09:41:28 +01:00
committed by GitHub
parent 1f971ce252
commit 598d54527a
+5 -1
View File
@@ -212,7 +212,11 @@ class Property(models.Model):
id = refs.pop(prop.res_id)
value = clean(values[id])
if value == default_value:
prop.unlink()
# avoid prop.unlink(), as it clears the record cache that can
# contain the value of other properties to set on record!
prop.check_access_rights('unlink')
prop.check_access_rule('unlink')
self._cr.execute("DELETE FROM ir_property WHERE id=%s", [prop.id])
elif value != clean(prop.get_by_record()):
prop.write({'value': value})