summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_controller.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-06-07 14:54:00 +0200
committerAaron Bohy <aab@odoo.com>2017-06-08 10:48:31 +0200
commit8648d16e458f96c0e313c27e5c2bc28a468c5f17 (patch)
treecb14eb86addb8eb3ce0ab79096431d7de893a41f /addons/web/static/src/js/views/basic/basic_controller.js
parent99ae418bf24171fbc6bb27584059c27efb857e77 (diff)
[FIX] web: correctly display nocontent helper if create='0'
When the root node of the arch has attribute 'create' set to '0', the generated DOM element must have classname 'o_cannot_create'. This is used to correctly display the nocontent helper (when there is no record). Before this rev., the helper indicated that the user can click on 'Create' to create a new record, even if the create action was disabled. This was for example the case in Point of Sale > Orders.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_controller.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js
index 4f6cf5e2ebb..16a066db495 100644
--- a/addons/web/static/src/js/views/basic/basic_controller.js
+++ b/addons/web/static/src/js/views/basic/basic_controller.js
@@ -46,6 +46,9 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
* @returns {Deferred}
*/
start: function () {
+ // add classname to reflect the (absence of) access rights (used to
+ // correctly display the nocontent helper)
+ this.$el.toggleClass('o_cannot_create', !this.activeActions.create);
return this._super.apply(this, arguments)
.then(this._updateEnv.bind(this));
},