summaryrefslogtreecommitdiff
path: root/addons/base_import/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-03-13 11:26:43 +0000
committerAaron Bohy <aab@odoo.com>2019-04-02 11:55:57 +0000
commit55676110c8787dfafd34a6508b207952f5c5eb88 (patch)
tree36e4816c38c73beb13e64d042a19fc0906499a3e /addons/base_import/static/src
parent7024f8d58bb279c800818955979ab73f1ee7b612 (diff)
[IMP] web: list: import attrs
The 'import' attrs is valid according to the rng definition of the list view. It is used in a few views in Odoo. However, it didn't actually work (in most cases, it worked by chance because it is set to "0" in addition to create="0", and create="0" already disables the import feature). With this ref, the 'import' attrs is taken into account and we can now disable the import feature even if the create one is enabled. Moreover, it is now documented.
Diffstat (limited to 'addons/base_import/static/src')
-rw-r--r--addons/base_import/static/src/js/import_buttons.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/base_import/static/src/js/import_buttons.js b/addons/base_import/static/src/js/import_buttons.js
index f6d246a8586..89baedc8113 100644
--- a/addons/base_import/static/src/js/import_buttons.js
+++ b/addons/base_import/static/src/js/import_buttons.js
@@ -13,11 +13,13 @@ var ImportViewMixin = {
/**
* @override
* @param {Object} params
- * @param {boolean} [params.import_enabled=true] determine if the import
- * button is visible (in the control panel)
+ * @param {boolean} [params.import_enabled=true] set to false to disable
+ * the Import feature (no 'Import' button in the control panel). Can also
+ * be disabled with 'import' attrs set to '0' in the arch.
*/
init: function (viewInfo, params) {
- var importEnabled = 'import_enabled' in params ? params.import_enabled : true;
+ var importEnabled = !!JSON.parse(this.arch.attrs.import || '1') &&
+ ('import_enabled' in params ? params.import_enabled : true);
this.controllerParams.importEnabled = importEnabled && !config.device.isMobile;
},
};