[FIX] mail: ensure unlink-all properly does its job for x2many
Before this commit, unlink-all would sometimes fail to unlink more than one record. This seems to be the case in particular for x2many relations with isCausal true. Indeed, the delete from isCausal is itself calling unlink-all on the inverse relation (the same record that was being unlinked-all in the first place) which would pre-emptively remove it from the same Set that was used during the initial iteration. The solution is to make a copy of the Set before iterating it to ensure all records that were planned to be removed are actually removed. Candidate fix for task-2410314 and definitely necessary for data integrity in general. closes odoo/odoo#80913 X-original-commit: 0077b93fea6f8c39ee535f19426c3f95a0e97e9f Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Alexandre Kühn
parent
acd946b8a8
commit
7925804e39
@@ -372,7 +372,7 @@ export class ModelField {
|
||||
}
|
||||
break;
|
||||
case 'unlink-all':
|
||||
if (this._setRelationUnlink(record, this.read(record), options)) {
|
||||
if (this._setRelationUnlink(record, this.get(record), options)) {
|
||||
hasChanged = true;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user