[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 of f14ae73a98 and
d0bb596f1d

Oversight of previous forward-port.
This commit is contained in:
Christophe Simonis
2019-06-07 12:37:49 +02:00
parent 3b63c7c2a6
commit 8670584299
+9 -3
View File
@@ -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``.