From: Gery Debongnie Date: Thu, 28 Nov 2013 10:49:29 +0000 (+0100) Subject: [REF] removes a few useless lines in view_loading method (addon web_graph) X-Git-Tag: InsPy_master01~620^2~142 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=6afd98516c4d18a146570184d3b667a3438ffdfc;p=odoo%2Fodoo.git [REF] removes a few useless lines in view_loading method (addon web_graph) bzr revid: ged@openerp.com-20131128104929-4ou50xebjub3bijh --- diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 5d4eade..de4d40a 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -120,8 +120,6 @@ instance.web_graph.GraphView = instance.web.View.extend({ view_loading: function (fields_view_get) { var self = this, model = new instance.web.Model(fields_view_get.model, {group_by_no_leaf: true}), - domain = [], - fields, row_groupby = []; // get the default groupbys and measure defined in the field view @@ -140,40 +138,35 @@ instance.web_graph.GraphView = instance.web.View.extend({ // get the most important fields (of the model) by looking at the // groupby filters defined in the search view - var load_view = instance.web.fields_view_get({ - model: model, - view_type: 'search', - }); - - var important_fields_def = $.when(load_view).then(function (search_view) { - var groups = _.select(search_view.arch.children, function (c) { - return (c.tag == 'group') && (c.attrs.string != 'Display'); - }); - _.each(groups, function(g) { - _.each(g.children, function (g) { - if (g.attrs.context) { - var field_id = py.eval(g.attrs.context).group_by; - self.important_fields.push(field_id); - } + var options = {model:model, view_type: 'search'}, + deferred1 = instance.web.fields_view_get(options).then(function (search_view) { + var groups = _.select(search_view.arch.children, function (c) { + return (c.tag == 'group') && (c.attrs.string != 'Display'); + }); + _.each(groups, function(g) { + _.each(g.children, function (g) { + if (g.attrs.context) { + var field_id = py.eval(g.attrs.context).group_by; + self.important_fields.push(field_id); + } + }); }); }); - }); // get the fields descriptions from the model - var field_descr_def = model.call('fields_get', []) - .then(function (fs) { fields = fs; }); + var deferred2 = model.call('fields_get', []).then(function (fs) { + self.fields = fs; + console.log("fiels",self.fields); + }); - return $.when(important_fields_def, field_descr_def) + return $.when(deferred1, deferred2) .then(function () { - self.fields = fields; var data = { model: model, - domain: domain, - fields: fields, + domain: [], measure: self.measure, col_groupby: [], row_groupby: row_groupby, - groups: [], }; self.pivot_table = new openerp.web_graph.PivotTable(data); @@ -181,7 +174,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ _.each(self.measure_list, function (measure) { var choice = $('').attr('data-choice', measure) .attr('href', '#') - .append(fields[measure].string); + .append(self.fields[measure].string); measure_selection.append($('
  • ').append(choice)); });