[FIX] core: in onchanges, verfiy that x2many are the same records
Comparing the length of the recordset is not enough for determining if there is changes on m2m. This also fix the merge off14ae73a98andd0bb596f1dOversight of previous forward-port.
This commit is contained in:
+9
-3
@@ -5481,14 +5481,20 @@ Fields:
|
||||
""" Return whether a field on record has changed. """
|
||||
record = self['<record>']
|
||||
subnames = self['<tree>'][name]
|
||||
if not subnames:
|
||||
if record._fields[name].type not in ('one2many', 'many2many'):
|
||||
return self[name] != record[name]
|
||||
else:
|
||||
return len(self[name]) != len(record[name]) or any(
|
||||
return (
|
||||
len(self[name]) != len(record[name])
|
||||
or (
|
||||
set(line_snapshot["<record>"].id for line_snapshot in self[name])
|
||||
!= set(record[name]._ids)
|
||||
)
|
||||
or any(
|
||||
line_snapshot.has_changed(subname)
|
||||
for line_snapshot in self[name]
|
||||
for subname in subnames
|
||||
)
|
||||
)
|
||||
|
||||
def diff(self, other):
|
||||
""" Return the values in ``self`` that differ from ``other``.
|
||||
|
||||
Reference in New Issue
Block a user