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 (grafted from 9dabdd3422a69e132269c4e9cc02076286aba3ed) --HG-- branch : 6.0
This commit is contained in:
1 parent
4e2c6c4325
commit
ea8477391a
1 file changed
+5
@@ -1182,6 +1182,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