Fix domain inversion of child_of mixing M2O and Reference fields

Domain inversion on Reference field does not work when using the dotted
notation with a M2O field using child_of or parent_of.

To solve this we correctly compute the localization of child_of leaves when
using the dotted notation (which renders the inverse_leaf function useless).
But we must also ensure that the selection used by reference fields restrict
the choice to the right models.

issue7869
review60441002
This commit is contained in:
Nicolas Évrard committed 2018-12-20 18:44:31 +01:00
1 parent 47026d0076
commit 5798cf5cbc
3 files changed
+155 -11

No files matched your search

+13 -4
View File
@@ -1911,8 +1911,8 @@
var screen_domain = domains[0];
var attr_domain = domains[1];
var inversion = new Sao.common.DomainInversion();
return inversion.concat([inversion.localize_domain(
inversion.inverse_leaf(screen_domain), this.name),
return inversion.concat([
inversion.localize_domain(screen_domain, this.name),
attr_domain]);
},
get_on_change_value: function(record) {
@@ -2442,10 +2442,19 @@
var screen_domain = domains[0];
var attr_domain = domains[1];
var inversion = new Sao.common.DomainInversion();
screen_domain = inversion.prepare_reference_domain(
screen_domain, this.name);
return inversion.concat([inversion.localize_domain(
inversion.filter_leaf(screen_domain, this.name, model),
true), attr_domain]);
},
get_models: function(record) {
var domains = this.get_domains(record);
var inversion = new Sao.common.DomainInversion();
return inversion.extract_reference_models(
inversion.concat(domains[0], domains[1]),
this.name);
},
_is_empty: function(record) {
var result = Sao.field.Reference._super._is_empty.call(
this, record);
@@ -2522,8 +2531,8 @@
var domains = this.get_domains(record);
var screen_domain = domains[0];
var attr_domain = domains[1];
return inversion.concat([inversion.localize_domain(
inversion.inverse_leaf(screen_domain)),
return inversion.concat([
inversion.localize_domain(screen_domain),
attr_domain]);
},
date_format: function(record) {