diff --git a/tryton/gui/window/view_form/model/group.py b/tryton/gui/window/view_form/model/group.py index 4bafa6c52c..527f7768ba 100644 --- a/tryton/gui/window/view_form/model/group.py +++ b/tryton/gui/window/view_form/model/group.py @@ -184,11 +184,12 @@ class ModelRecordGroup(SignalEvent): if newmod and display: self.signal('model-changed', newmod) - if modified: + if modified and newmods: for newmod in newmods: newmod.modified = True - if newmod.parent: - newmod.signal('record-changed', newmod.parent) + # send record-changed only once + if newmod.parent: + newmod.signal('record-changed', newmod.parent) self.current_idx = 0 return True @@ -291,7 +292,7 @@ class ModelRecordGroup(SignalEvent): return None return self.models[self.current_idx] - def remove(self, model, remove=False, modified=True): + def remove(self, model, remove=False, modified=True, signal=True): idx = self.models.index(model) if self.models[idx].id > 0: if remove: @@ -303,7 +304,8 @@ class ModelRecordGroup(SignalEvent): if modified: model.modified = True self.models.remove(self.models[idx]) - model.signal('record-changed', model.parent) + if signal: + model.signal('record-changed', model.parent) def add_fields_custom(self, fields, models): to_add = [] diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index fefd952198..ad01ca7f44 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -515,7 +515,9 @@ class Screen(SignalEvent): # set current model to None to prevent __select_changed # to save the previous_model as it can be already deleted. self.current_model = None - self.models.remove(model, remove=remove) + self.models.remove(model, remove=remove, signal=False) + # send record-changed only once + model.signal('record-changed', model.parent) if self.models.models: idx = min(idx, len(self.models.models)-1) self.current_model = self.models.models[idx]