Do not remove record from the looped list when setting list ids

issue10638
review358561002
This commit is contained in:
Raphaël Valéry committed 2021-08-11 18:02:25 +02:00
1 parent e6dce5a40b
commit e10f592b73
1 file changed
+3 -3
+3 -3
View File
@@ -681,9 +681,9 @@ class O2MField(Field):
group.load_fields(fields)
if mode == 'list ids':
for old_record in group:
if old_record.id not in value:
group.remove(old_record, remove=True, signal=False)
records_to_remove = [r for r in group if r.id not in value]
for record_to_remove in records_to_remove:
group.remove(record_to_remove, remove=True, signal=False)
group.load(value, modified=modified or default)
else:
for vals in value: