details: https://code.tryton.org/tryton/commit/5cff834316cf
branch: 7.0
user: Cédric Krier <[email protected]>
date: Fri Jan 23 09:57:31 2026 +0100
description:
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
(grafted from 4a30450c54bd6d75614fa1cfffeb7498a669cbcf)
diffstat:
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, 0 insertions(+), 16 deletions(-)
diffs (70 lines):
diff -r 69da72cb4c13 -r 5cff834316cf sao/src/model.js
--- a/sao/src/model.js Tue Jan 20 18:43:53 2026 +0100
+++ b/sao/src/model.js Fri Jan 23 09:57:31 2026 +0100
@@ -2580,11 +2580,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 -r 69da72cb4c13 -r 5cff834316cf sao/src/view/form.js
--- a/sao/src/view/form.js Tue Jan 20 18:43:53 2026 +0100
+++ b/sao/src/view/form.js Fri Jan 23 09:57:31 2026 +0100
@@ -3501,8 +3501,6 @@
var context = this.field.get_search_context(this.record);
domain = [domain,
this.record.expr_eval(this.attributes.add_remove)];
- var removed_ids = this.field.get_removed_ids(this.record);
- domain = ['OR', domain, ['id', 'in', removed_ids]];
var text = this.wid_text.val();
var sequence = this._sequence();
@@ -3768,8 +3766,6 @@
var domain = this.field.get_domain(this.record);
domain = [domain,
this.record.expr_eval(this.attributes.add_remove)];
- 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 -r 69da72cb4c13 -r 5cff834316cf
tryton/tryton/gui/window/view_form/model/field.py
--- a/tryton/tryton/gui/window/view_form/model/field.py Tue Jan 20 18:43:53
2026 +0100
+++ b/tryton/tryton/gui/window/view_form/model/field.py Fri Jan 23 09:57:31
2026 +0100
@@ -903,9 +903,6 @@
self._set_default_value(record)
super(O2MField, self).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 -r 69da72cb4c13 -r 5cff834316cf
tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py
--- a/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py Tue Jan
20 18:43:53 2026 +0100
+++ b/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py Fri Jan
23 09:57:31 2026 +0100
@@ -483,8 +483,6 @@
domain = self.field.domain_get(self.record)
context = self.field.get_search_context(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get('add_remove'))]
- removed_ids = self.field.get_removed_ids(self.record)
- domain = ['OR', domain, ('id', 'in', removed_ids)]
text = self.wid_text.get_text()
self.focus_out = False
@@ -586,8 +584,6 @@
model = self.attrs['relation']
domain = self.field.domain_get(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get('add_remove'))]
- 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)