[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:
@@ -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})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user