diff --git a/base_export_manager/__manifest__.py b/base_export_manager/__manifest__.py index d72ac74d5b..8838012fb8 100644 --- a/base_export_manager/__manifest__.py +++ b/base_export_manager/__manifest__.py @@ -25,7 +25,7 @@ "license": "AGPL-3", "assets": { "web.assets_backend": [ - "base_export_manager/static/src/views/list/list_controller.js", + "base_export_manager/static/src/views/list/list_controller.esm.js", "base_export_manager/static/src/xml/base.xml", ], }, diff --git a/base_export_manager/models/ir_exports_line.py b/base_export_manager/models/ir_exports_line.py index e3ca87b67f..afe7d51872 100644 --- a/base_export_manager/models/ir_exports_line.py +++ b/base_export_manager/models/ir_exports_line.py @@ -140,7 +140,7 @@ def _inverse_name(self): one.field_n(num, True) ] = one._get_field_id(model, field_name) if any(parts): - # invalidate_cache -> in order to get actual value of field 'label' + # invalidate_recordset -> in order to get actual value of field 'label' # in function '_check_name' one.invalidate_recordset(["label"]) one._check_name() diff --git a/base_export_manager/static/src/views/list/list_controller.esm.js b/base_export_manager/static/src/views/list/list_controller.esm.js new file mode 100644 index 0000000000..4e8bd9d341 --- /dev/null +++ b/base_export_manager/static/src/views/list/list_controller.esm.js @@ -0,0 +1,21 @@ +/** @odoo-module **/ + +import {ListController} from "@web/views/list/list_controller"; +const {onWillRender} = owl; +import {patch} from "@web/core/utils/patch"; +import {session} from "@web/session"; + +patch(ListController.prototype, "base_export_manager", { + setup() { + this._super(...arguments); + onWillRender(async () => { + if (this.isExportEnable) { + const is_export_enabled = + session.export_models.indexOf(this.model.root.resModel) !== -1; + if (!session.is_system && !is_export_enabled) { + this.isExportEnable = false; + } + } + }); + }, +});