From d59d2ce496527883dcb40fdcbb0e9e78c4097aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 23 Jan 2026 09:57:31 +0100 Subject: [PATCH] Do not include removed records in the search domain of One2Many Adding an OR-ed clause prevents the domain inversion to set any unique values when creating a record from the search window. The removed records can be re-add with the undelete button instead. Closes #14540 --- sao/src/model.js | 5 ----- sao/src/view/form.js | 4 ---- tryton/tryton/gui/window/view_form/model/field.py | 3 --- tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py | 4 ---- 4 files changed, 16 deletions(-) diff --git a/sao/src/model.js b/sao/src/model.js index 523df88920..29f8c5a619 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2637,11 +2637,6 @@ } return result; }, - get_removed_ids: function(record) { - return record._values[this.name].record_removed.map(function(r) { - return r.id; - }); - }, get_domain: function(record) { var domains = this.get_domains(record); var attr_domain = domains[1]; diff --git a/sao/src/view/form.js b/sao/src/view/form.js index b1ac87a4c9..ec0b4973a3 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -3692,8 +3692,6 @@ function eval_pyson(value){ if (existing_ids.length) { domain = [domain, ['id', 'not in', existing_ids]]; } - var removed_ids = this.field.get_removed_ids(this.record); - domain = ['OR', domain, ['id', 'in', removed_ids]]; var text = this.wid_text.val(); if (this._popup) { @@ -3986,8 +3984,6 @@ function eval_pyson(value){ if (existing_ids.length) { domain = [domain, ['id', 'not in', existing_ids]]; } - var removed_ids = this.field.get_removed_ids(this.record); - domain = ['OR', domain, ['id', 'in', removed_ids]]; return Sao.common.update_completion( this.wid_text, this.record, this.field, model, domain); }, diff --git a/tryton/tryton/gui/window/view_form/model/field.py b/tryton/tryton/gui/window/view_form/model/field.py index 69e6e01578..01b941f849 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -931,9 +931,6 @@ class O2MField(Field): self._set_default_value(record) super().state_set(record, states=states) - def get_removed_ids(self, record): - return [x.id for x in record.value[self.name].record_removed] - def domain_get(self, record): screen_domain, attr_domain = self.domains_get(record) # Forget screen_domain because it only means at least one record diff --git a/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py b/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py index 06b5f48f26..2803083ac9 100644 --- a/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py +++ b/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py @@ -512,8 +512,6 @@ class One2Many(Widget): existing_ids = self.field.get_eval(self.record) if existing_ids: domain = [domain, ('id', 'not in', existing_ids)] - removed_ids = self.field.get_removed_ids(self.record) - domain = ['OR', domain, ('id', 'in', removed_ids)] text = self.wid_text.get_text() if self._popup: @@ -621,8 +619,6 @@ class One2Many(Widget): existing_ids = self.field.get_eval(self.record) if existing_ids: domain = [domain, ('id', 'not in', existing_ids)] - removed_ids = self.field.get_removed_ids(self.record) - domain = ['OR', domain, ('id', 'in', removed_ids)] update_completion(self.wid_text, self.record, self.field, model, domain=domain)