diff options
| author | Jinal Patel <jip@odoo.com> | 2019-08-09 05:09:01 +0000 |
|---|---|---|
| committer | Jinal Patel <jip@odoo.com> | 2019-08-09 12:32:27 +0000 |
| commit | f0fdfbf44e1db97f9d9b1425be81b53138c01bd6 (patch) | |
| tree | 920e6450e622108e28db2a907db376bd5ad41531 /addons/web/static/src/js/widgets/model_field_selector.js | |
| parent | a72b23f6b5fbcf637d5de16f9f05ba00552cc186 (diff) | |
[FIX] web: add support for TRUE_LEAF and FALSE_LEAF in ModelFieldSelector
before this commit, domain selector widget does not support
TRUE_LEAF and FALSE_LEAF i.e. [(1, '=', 1)] and [(0, '=', 1)] respectively,
the reason is the chain part of the domain i.e. field name has value 1/0 and
we don't have field name like 1 and 0 in domain and hence ModelFieldSelector
don't accept it
after this commit, domain selector can handle this special two domains which is
[(1, '=', 1)] and [(0, '=', 1)], add support for chain with 1/0 in ModelFieldSelector
task- 1998145
closes odoo/odoo#35603
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/widgets/model_field_selector.js')
| -rw-r--r-- | addons/web/static/src/js/widgets/model_field_selector.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js index 08a7ae47c81..ed74b2da44a 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -301,11 +301,16 @@ var ModelFieldSelector = Widget.extend({ }).bind(this)); function processChain(chain) { - var field = this._getLastPageField(chain.pop()); + var fieldName = chain.pop(); + var field = this._getLastPageField(fieldName); if (field && field.relation && chain.length > 0) { // Fetch next chain node if any and possible return this._pushPageData(field.relation).then(processChain.bind(this, chain)); } else if (field && chain.length === 0) { // Last node fetched return Promise.resolve(); + } else if (!field && fieldName === "1") { // TRUE_LEAF + this._validate(true); + } else if (!field && fieldName === "0") { // FALSE_LEAF + this._validate(true); } else { // Wrong node chain this._validate(false); } |
