details: https://code.tryton.org/tryton/commit/a1485a28b520
branch: default
user: Cédric Krier <[email protected]>
date: Wed Oct 28 13:24:04 2026 +0100
description:
Destroy records only after the deletion on the server side has succeeded
If the deletion fails (ex: due to a check raising a user error), the
records
must not be destroyed.
Closes #15197
diffstat:
sao/src/model.js | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (26 lines):
diff -r 8455b4444125 -r a1485a28b520 sao/src/model.js
--- a/sao/src/model.js Wed Oct 28 13:48:36 2026 +0100
+++ b/sao/src/model.js Wed Oct 28 13:24:04 2026 +0100
@@ -291,14 +291,16 @@
return record.id;
});
return root_group.on_write_ids(record_ids).then(reload_ids => {
- for (const record of records) {
- record.destroy();
- }
reload_ids = reload_ids.filter(e => !~record_ids.indexOf(e));
return this.model.execute('delete', [record_ids], context)
- .then(() => {
- root_group.reload(reload_ids);
- });
+ .then(() => {
+ for (const record of records) {
+ record.destroy();
+ }
+ if (reload_ids.length) {
+ root_group.reload(reload_ids);
+ }
+ });
});
};
Object.defineProperty(array, 'root_group', {