Find invalid records of xxx2Many field using intersection
For xxx2Many field, the contain test is not working correctly because the field value is a tuple of records which is never in the list of invalid relations. Closes #12099
This commit is contained in:
1 parent
f471e81c11
commit
30d2bcb2a8
1 file changed
+5
@@ -1271,6 +1271,11 @@ class ModelStorage(Model):
|
||||
'many2one', 'one2many', 'many2many', 'one2one',
|
||||
'reference'}:
|
||||
invalid_records = invalid_relations
|
||||
elif field._type.endswith('2many'):
|
||||
invalid_records = [
|
||||
r for r in records
|
||||
if invalid_relations.intersection(
|
||||
getattr(r, field.name))]
|
||||
else:
|
||||
invalid_records = [
|
||||
r for r in records
|
||||
|
||||
Reference in new issue
Block a user