diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-07-06 09:37:49 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-07-09 07:23:04 +0000 |
| commit | 350ed97c4556f6c6ea1a736db0ea5a804b28ba08 (patch) | |
| tree | fa582e732f3426a1c7a2cda9cb8344e9702b5a0d /addons/web/static/src/js/views | |
| parent | ccea563abbbae48b7b914f5b12e59b02e167d486 (diff) | |
[FIX] web: async operations should not live in init
Support for the "allow exports" group was implemented by checking the
group in init(), which is sync. Move that check over to willStart
instead.
Also add a default mock for user_has_group (makes it so it always
replies that the user doesn't have the group), and override that
specifically for the group we're interested in in the export tests, so
those tests have access to the Export action / option.
closes odoo/odoo#54254
X-original-commit: 30968ac93373990338c23f49e678d272b8e60c6b
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_controller.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index 42da94f7166..12a3e8c75e1 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -58,9 +58,15 @@ var ListController = BasicController.extend({ this.fieldChangedPrevented = false; this.isPageSelected = false; // true iff all records of the page are selected this.isDomainSelected = false; // true iff the user selected all records matching the domain - session.user_has_group('base.group_allow_export').then(has_group => { - this.isExportEnable = has_group; + this.isExportEnable = false; + }, + + willStart() { + const sup = this._super(...arguments); + const acl = session.user_has_group('base.group_allow_export').then(hasGroup => { + this.isExportEnable = hasGroup; }); + return Promise.all([sup, acl]); }, //-------------------------------------------------------------------------- |
