diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2018-10-09 14:34:21 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2018-10-10 15:02:10 +0000 |
| commit | 5c6edfc8d339d010bccf6e4426e315e911b21ee5 (patch) | |
| tree | b2342b4899ebe34b02c292a9fc98200f2caaa2ad /odoo/addons/base/static/src | |
| parent | c9041e8dcfbfe93676f4d2cb1bf96e512afbac38 (diff) | |
[FIX] base: res_config_settings allow deferred field
If a deferred field, for example with auth_user_policy installed:
<field name="f" password="True" widget="password_meter"/>
is inside the res_config_settings view, the rendering will be deferred
which is not taken into account when initializing the content
(_initModules) or attaching to DOM (after start).
Thus we would would get an error and have no access to settings.
The issue that happened in 12.0 was solved with 23bec7fb7 and refactored
in between in 5bbbd25ed, but the heart of the issue was not solved in
the case of a customization.
With this commit, we do not lose the deferred when it is necessary to
keep them in the case of deferred while rendering.
Without fix, the added test fails with a traceback and message:
TypeError: Cannot read property 'settingView' of undefined
opw-1890343
closes #27589
Diffstat (limited to 'odoo/addons/base/static/src')
| -rw-r--r-- | odoo/addons/base/static/src/js/res_config_settings.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/odoo/addons/base/static/src/js/res_config_settings.js b/odoo/addons/base/static/src/js/res_config_settings.js index 855b03452ae..6edb5a7e264 100644 --- a/odoo/addons/base/static/src/js/res_config_settings.js +++ b/odoo/addons/base/static/src/js/res_config_settings.js @@ -24,12 +24,13 @@ var BaseSettingRenderer = FormRenderer.extend({ }, start: function () { - this._super.apply(this, arguments); + var res = this._super.apply(this, arguments); if (config.device.isMobile) { core.bus.on("DOM_updated", this, function () { this._moveToTab(this.currentIndex || this._currentAppIndex()); }); } + return res; }, /** @@ -266,14 +267,16 @@ var BaseSettingRenderer = FormRenderer.extend({ }, _render: function () { + var self = this; var res = this._super.apply(this, arguments); - this._initModules(); - this._renderLeftPanel(); - this._initSearch(); - if (config.device.isMobile) { - this._enableSwipe(); - } - return res; + return res.then(function () { + self._initModules(); + self._renderLeftPanel(); + self._initSearch(); + if (config.device.isMobile) { + self._enableSwipe(); + } + }); }, _renderLeftPanel: function () { |
