diff options
| author | Vidhin Mehta (OpenERP) <vme@tinyerp.com> | 2012-06-21 20:16:40 +0530 |
|---|---|---|
| committer | Vidhin Mehta (OpenERP) <vme@tinyerp.com> | 2012-06-21 20:16:40 +0530 |
| commit | 9c8d325d97fd84884e8eef6ff79458cb0709f3c9 (patch) | |
| tree | f0cb52e3a2c83806a4adeab32b2db729b2fa4daa | |
| parent | 235cca3aabd83d23cca0d93852bdaf55d9183667 (diff) | |
[IMP]get dashboard from menu also.
bzr revid: vme@tinyerp.com-20120621144640-by7y68e7bx19e3f1
| -rw-r--r-- | addons/web/static/src/js/search.js | 32 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 2 |
2 files changed, 29 insertions, 5 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 30c339ab279..80214fe20ba 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1635,11 +1635,12 @@ instance.web.search.AddToDashboard = instance.web.search.Input.extend({ this.$element .on('click', 'h4', this.proxy('show_option')) .on('submit', 'form', function (e) {e.preventDefault(); self.add_dashboard();}); - return $.when(this.load_data(),this.data_loaded).pipe(self.proxy("render_data")); + return $.when(this.load_data(),this.data_loaded).pipe(this.proxy("render_data")); }, load_data:function(){ - var self = this, - ir_actions_act_window = new instance.web.Model('ir.actions.act_window',{},[['res_model','=',"board.board"],['view_id','!=',false]]) + // get from database if dashboard position change than also works(from Reporting to else). + /*var self = this, + ir_actions_act_window = new instance.web.Model('ir.actions.act_window',{},[['res_model','=',"board.board"]]) .query(['name','id']), map_data = function(){ var ir_actions_values = arguments[0],ir_values = arguments[1]; @@ -1663,7 +1664,30 @@ instance.web.search.AddToDashboard = instance.web.search.Input.extend({ ir_value._execute().done(function(ir_values){ map_data(ir_actions_values,ir_values); }) - }); + });*/ + + //===============================get from instance.webclient.menu (with less rpc call) + + var dashbaord_menu = instance.webclient.menu.data.data.children,self = this, + map_data = function(result){ + _.detect(dashbaord_menu,function(dash){ + var id = _.pluck(dash.children,"id"); + var indexof = _.indexOf(id, result.res_id); + if(indexof !== -1){ + self.dashboard_data = dash.children[indexof].children + console.log(self.dashboard_data); + return; + } + self.data_loaded.resolve(); + }); + }; + return new instance.web.Model('ir.model.data') + .query(['res_id']) + .filter([['name','=','menu_reporting_dashboard']]) + .first() + .done(function (result) { + map_data(result) + }); }, render_data: function(){ diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index d880293a04a..0d79aebbd04 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1397,7 +1397,7 @@ <t t-name="SearchView.addtodashboard.selection"> <select title = "Select Dashboard to add this filter to"> <t t-foreach="selections" t-as="element"> - <option t-att-value="element.res_id"><t t-esc="element.name"/></option> + <option t-att-value="element.id || element.res_id "><t t-esc="element.name"/></option> </t> </select> </t> |
