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!
# 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),
)