From 686c799097096ca0abea4da3df2f534a950ff59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Thu, 14 Dec 2023 17:54:27 +0100 Subject: [PATCH] Mark M2M records for addition in parent after they're saved Closes #12832 (grafted from 4e8ff04aef3a2bfd175e2c77db1421810adc5159) --HG-- branch : 7.0 --- sao/src/view/form.js | 4 ++++ tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sao/src/view/form.js b/sao/src/view/form.js index c483f97c79..57b07ac935 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -4071,8 +4071,12 @@ function eval_pyson(value){ const callback = result => { if (result) { screen.current_record.save().done(() => { + var added = 'id' in this.screen.current_record.modified_fields; // Force a reload on next display this.screen.current_record.cancel(); + if (added) { + this.screen.current_record.modified_fields.id = true; + } }); } }; diff --git a/tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py b/tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py index dcf966b908..cb8c25a751 100644 --- a/tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -224,8 +224,11 @@ class Many2Many(Widget): def callback(result): if result: screen.current_record.save() + added = 'id' in self.screen.current_record.modified_fields # Force a reload on next display self.screen.current_record.cancel() + if added: + self.screen.current_record.modified_fields.setdefault('id') # Force a display to clear the CellCache self.screen.display() WinForm(screen, callback)