diff options
| author | shreya thakrar <sht@odoo.com> | 2019-09-02 06:31:43 +0000 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2020-03-09 16:46:20 +0000 |
| commit | b3ece2074a2cc40faf3b76d39fa86490239e8be0 (patch) | |
| tree | 0cc6e3f35c7e79eb72443f90c46a6832edc451ba /addons | |
| parent | 9ab34d87717b18d21ad050a3a0d0fe9f1c865efc (diff) | |
[FIX] web: properly set page data in 'ModelFieldSelector' widget
When passing a default field chain to ModelFieldSelector, the page data is
not set correctly for the relational field. To understand the issue :
- login to v11 enterprise all db branch in runbot (debug mode recommended)
- create a mass mailing, add subject, select 'Contact' in `Recipients` field
- click on domain selector and select 'Company' from ModelFieldSelector popover
- click somewhere else to close the popover
- again open domain selector and observe the popover
Current behavior : fields of `Contact` are visible in the page even thogh
`Company` is selected in the ModelFieldSelector
Expected behavior : fields of `Company` should be visible
This commit fixes the issue by correctly pushing the page data
in ModelFieldSelector.
task - 2058702
closes odoo/odoo#47231
X-original-commit: 5746c2705c324b124445f38ead4f75624b3f99e3
Related: odoo/enterprise#9124
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/static/src/js/widgets/model_field_selector.js | 8 |
1 files changed, 6 insertions, 2 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 ed74b2da44a..8f560be6d39 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -303,8 +303,12 @@ var ModelFieldSelector = Widget.extend({ function processChain(chain) { 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)); + if (field && field.relation) { + if (chain.length) { // Fetch next chain node if any and possible + return this._pushPageData(field.relation).then(processChain.bind(this, chain)); + } else { // Simply update the last popover page + return this._pushPageData(field.relation); + } } else if (field && chain.length === 0) { // Last node fetched return Promise.resolve(); } else if (!field && fieldName === "1") { // TRUE_LEAF |
