From 85066e7bcd7d1066c059d249e7f5efa6b3e1d40a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 9 Mar 2016 11:30:53 +0100 Subject: [PATCH 1/6] [REF] web: /web/action/load: remove unused 'do_not_eval' argument unused since rev. odoo/odoo@4a5cb1ebc478cb650a2bf33081f101e4f74bc6fe. --- addons/web/controllers/main.py | 2 +- addons/web/static/src/js/framework/view.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index b88a103a8df..fc66bb394b5 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1103,7 +1103,7 @@ class Binary(http.Controller): class Action(http.Controller): @http.route('/web/action/load', type='json', auth="user") - def load(self, action_id, do_not_eval=False, additional_context=None): + def load(self, action_id, additional_context=None): Actions = request.session.model('ir.actions.actions') value = False try: diff --git a/addons/web/static/src/js/framework/view.js b/addons/web/static/src/js/framework/view.js index b234d02390f..29307b61833 100644 --- a/addons/web/static/src/js/framework/view.js +++ b/addons/web/static/src/js/framework/view.js @@ -153,7 +153,6 @@ var View = Widget.extend({ return this.rpc('/web/action/load', { action_id: action_data.name, context: _.extend(pyeval.eval('context', context), {'active_model': dataset.model, 'active_ids': dataset.ids, 'active_id': record_id}), - do_not_eval: true }).then(handler); } else { return dataset.exec_workflow(record_id, action_data.name).then(handler); From 141f4d95bd57f24fb06636a0720cc3665caac39d Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 24 Feb 2016 15:35:13 +0100 Subject: [PATCH 2/6] [REF] web_kanban: render_buttons() A special case for X2ManyKanban views was handled in the Kanban view itself. This commit makes the X2Many case identical to the general case by setting options.action_buttons to true if the X2Many field is not readonly. --- .../static/src/js/views/form_relational_widgets.js | 1 + addons/web_kanban/static/src/js/kanban_view.js | 13 ++++--------- addons/web_kanban/static/src/xml/web_kanban.xml | 12 +++++------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 600751b8b83..79318721efa 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -774,6 +774,7 @@ var FieldX2Many = AbstractManyField.extend({ } } else if (view.view_type === "kanban") { _.extend(view.options, { + action_buttons: true, confirm_on_delete: false, }); if (self.get("effective_readonly")) { diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js index 7eca4df2452..7f339f40bdd 100644 --- a/addons/web_kanban/static/src/js/kanban_view.js +++ b/addons/web_kanban/static/src/js/kanban_view.js @@ -303,16 +303,11 @@ var KanbanView = View.extend({ * $node may be undefined, in which case the ListView inserts them into this.options.$buttons */ render_buttons: function($node) { - var display = false; - if (this.options.action_buttons !== false) { - display = this.is_action_enabled('create'); - } else if (!this.view_id && !this.options.read_only_mode) { - display = this.is_action_enabled('write') || this.is_action_enabled('create'); + if (this.options.action_buttons !== false && this.is_action_enabled('create')) { + this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); + this.$buttons.on('click', 'button.o-kanban-button-new', this.add_record.bind(this)); + this.$buttons.appendTo($node); } - this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this, display: display})); - this.$buttons.on('click', 'button.o-kanban-button-new', this.add_record.bind(this)); - - this.$buttons.appendTo($node); }, render_pager: function($node, options) { diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index c6275a31bf5..01593bf0a37 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -1,13 +1,11 @@