Filter out existing records from the search results of xxx2Many
Closes #3285
This commit is contained in:
1 parent
f4e9ef595a
commit
40520b9ad0
3 files changed
+28
No files matched your search
@@ -3618,6 +3618,10 @@ function eval_pyson(value){
|
||||
var context = this.field.get_search_context(this.record);
|
||||
domain = [domain,
|
||||
this.record.expr_eval(this.attributes.add_remove)];
|
||||
let existing_ids = this.field.get_eval(this.record);
|
||||
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();
|
||||
@@ -3909,6 +3913,10 @@ function eval_pyson(value){
|
||||
var domain = this.field.get_domain(this.record);
|
||||
domain = [domain,
|
||||
this.record.expr_eval(this.attributes.add_remove)];
|
||||
let existing_ids = this.field.get_eval(this.record);
|
||||
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(
|
||||
@@ -4169,6 +4177,10 @@ function eval_pyson(value){
|
||||
if (!jQuery.isEmptyObject(add_remove)) {
|
||||
domain = [domain, add_remove];
|
||||
}
|
||||
let existing_ids = this.field.get_eval(this.record);
|
||||
if (existing_ids.length) {
|
||||
domain = [domain, ['id', 'not in', existing_ids]];
|
||||
}
|
||||
var context = this.field.get_search_context(this.record);
|
||||
var order = this.field.get_search_order(this.record);
|
||||
var value = this.entry.val();
|
||||
@@ -4327,6 +4339,10 @@ function eval_pyson(value){
|
||||
if (!jQuery.isEmptyObject(add_remove)) {
|
||||
domain = [domain, add_remove];
|
||||
}
|
||||
let existing_ids = this.field.get_eval(this.record);
|
||||
if (existing_ids.length) {
|
||||
domain = [domain, ['id', 'not in', existing_ids]];
|
||||
}
|
||||
return Sao.common.update_completion(
|
||||
this.entry, this.record, this.field, model, domain);
|
||||
},
|
||||
|
||||
@@ -177,6 +177,9 @@ class Many2Many(Widget):
|
||||
add_remove = self.record.expr_eval(self.attrs.get('add_remove'))
|
||||
if add_remove:
|
||||
domain = [domain, add_remove]
|
||||
existing_ids = self.field.get_eval(self.record)
|
||||
if existing_ids:
|
||||
domain = [domain, ('id', 'not in', existing_ids)]
|
||||
context = self.field.get_search_context(self.record)
|
||||
order = self.field.get_search_order(self.record)
|
||||
value = self.wid_text.get_text()
|
||||
@@ -369,6 +372,9 @@ class Many2Many(Widget):
|
||||
add_remove = self.record.expr_eval(self.attrs.get('add_remove'))
|
||||
if add_remove:
|
||||
domain = [domain, add_remove]
|
||||
existing_ids = self.field.get_eval(self.record)
|
||||
if existing_ids:
|
||||
domain = [domain, ('id', 'not in', existing_ids)]
|
||||
update_completion(
|
||||
self.wid_text, self.record, self.field, model, domain)
|
||||
|
||||
|
||||
@@ -506,6 +506,9 @@ class One2Many(Widget):
|
||||
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'))]
|
||||
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()
|
||||
@@ -612,6 +615,9 @@ class One2Many(Widget):
|
||||
model = self.attrs['relation']
|
||||
domain = self.field.domain_get(self.record)
|
||||
domain = [domain, self.record.expr_eval(self.attrs.get('add_remove'))]
|
||||
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,
|
||||
|
||||
Reference in new issue
Block a user