From 9d49ade263ed54e394ddf34f9415da99cb335aef Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 17 May 2011 11:26:27 +0200 Subject: [PATCH] [FIX] Fixed action flags bzr revid: fme@openerp.com-20110517092627-oz2rj1hkpfi5zp30 --- addons/base/static/src/js/views.js | 14 ++++++++++++-- addons/base_dashboard/static/src/js/dashboard.js | 11 ++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/addons/base/static/src/js/views.js b/addons/base/static/src/js/views.js index dee28dfafa9..c7363fbb9c7 100644 --- a/addons/base/static/src/js/views.js +++ b/addons/base/static/src/js/views.js @@ -24,6 +24,7 @@ openerp.base.ActionManager = openerp.base.Controller.extend({ sidebar : true, search_view : true, new_window : false, + views_switcher : true, toolbar : true, pager : true }, action.flags || {}); @@ -46,6 +47,7 @@ openerp.base.ActionManager = openerp.base.Controller.extend({ viewmanager.start(); this.dialog_stack.push(viewmanager); } else if (action.flags.new_window) { + action.flags.new_window = false; this.rpc("/base/session/save_session_action", { the_action : action}, function(key) { var url = window.location.protocol + "//" + window.location.host + window.location.pathname + "?" + jQuery.param({ s_action : "" + key }); @@ -79,6 +81,7 @@ openerp.base.ViewManager = openerp.base.Controller.extend({ this.active_view = null; this.views_src = views; this.views = {}; + this.flags = this.flags || {}; }, /** * @returns {jQuery.Deferred} initial view loading promise @@ -93,6 +96,9 @@ openerp.base.ViewManager = openerp.base.Controller.extend({ _.each(this.views_src, function(view) { self.views[view[1]] = { view_id: view[0], controller: null }; }); + if (this.flags.views_switcher === false) { + this.$element.find('.oe_vm_switch').hide(); + } // switch to the first one in sequence return this.on_mode_switch(this.views_src[0][1]); }, @@ -116,7 +122,7 @@ openerp.base.ViewManager = openerp.base.Controller.extend({ this.views[view_type].controller = controller; } - if(this.searchview) { + if (this.searchview) { if (view.controller.searchable === false) { this.searchview.hide(); } else { @@ -152,6 +158,9 @@ openerp.base.ViewManager = openerp.base.Controller.extend({ this.searchview.stop(); } this.searchview = new openerp.base.SearchView(this, this.session, this.element_id + "_search", this.dataset, view_id, search_defaults); + if (this.flags.search_view === false) { + this.searchview.hide(); + } this.searchview.on_search.add(function(domains, contexts, groupbys) { self.views[self.active_view].controller.do_search.call( self, domains.concat(self.domains()), @@ -201,7 +210,8 @@ openerp.base.ViewManagerAction = openerp.base.ViewManager.extend({ } this._super(session, element_id, dataset, action.views); this.action = action; - if (action.flags.sidebar) { + this.flags = this.action.flags || {}; + if (this.flags.sidebar) { this.sidebar = new openerp.base.Sidebar(null, this); } }, diff --git a/addons/base_dashboard/static/src/js/dashboard.js b/addons/base_dashboard/static/src/js/dashboard.js index 34d09f80e62..1d8f433bd40 100644 --- a/addons/base_dashboard/static/src/js/dashboard.js +++ b/addons/base_dashboard/static/src/js/dashboard.js @@ -55,10 +55,11 @@ openerp.base.form.Action = openerp.base.form.Widget.extend({ on_load_action: function(result) { var action = result.action; - action.search_view = false; - action.no_sidebar = true; - action.search_view_id = false; - + action.flags = { + search_view : false, + sidebar : false, + views_switcher : false + } var node_attrs = this.node.attrs; var get_column = ['first', 'second', 'third']; var board_element = this.board.element.find('[id=column-'+get_column[this.child_index]+']'); @@ -101,4 +102,4 @@ openerp.base.form.Vpaned = openerp.base.form.Widget.extend({ openerp.base.form.widgets.add('hpaned', 'openerp.base.form.Board'); openerp.base.form.widgets.add('vpaned', 'openerp.base.form.Vpaned'); openerp.base.form.widgets.add('action', 'openerp.base.form.Action'); -} \ No newline at end of file +}