[FIX] models: in method onchange(), check for record dirtiness only on *2many fiels
Cascading onchanges can be caused by a related field computed in cache. This causes a bug in sale order lines, were setting the uom field forces reading product fields, which are inherited from product templates. The inherited fields are computed as related fields, which marks the product record as dirty. This subsequently triggers an onchange on the product field, which resets the uom field!
This commit is contained in:
parent
13bd2eaa3e
commit
ad14acab32
|
@ -5694,8 +5694,9 @@ class BaseModel(object):
|
|||
# determine which fields have been modified
|
||||
for name, oldval in values.iteritems():
|
||||
newval = record[name]
|
||||
if newval != oldval or getattr(newval, '_dirty', False):
|
||||
field = self._fields[name]
|
||||
field = self._fields[name]
|
||||
if newval != oldval or \
|
||||
field.type in ('one2many', 'many2many') and newval._dirty:
|
||||
result['value'][name] = field.convert_to_write(
|
||||
newval, record._origin, subfields.get(name),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue