[FIX] correctly compares groupby in pivot_table to avoid bugs/crashes (now, it ignores the 'interval' attributes) so the table can interact with the graph view (addon web_graph)
bzr revid: ged@openerp.com-20140115105104-qff3t47lo1lyp5wd
This commit is contained in:
parent
cf81efda43
commit
4343ca278a
|
@ -77,8 +77,8 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend(openerp.EventDispatcherM
|
|||
var row_gbs = this.create_field_values(row_groupby),
|
||||
col_gbs = this.create_field_values(col_groupby),
|
||||
dom_changed = !_.isEqual(this.domain, domain),
|
||||
row_gb_changed = !_.isEqual(row_gbs, this.rows.groupby),
|
||||
col_gb_changed = !_.isEqual(col_gbs, this.cols.groupby);
|
||||
row_gb_changed = !this.equal_groupby(row_gbs, this.rows.groupby),
|
||||
col_gb_changed = !this.equal_groupby(col_gbs, this.cols.groupby);
|
||||
|
||||
if (dom_changed) {
|
||||
this.domain = domain;
|
||||
|
@ -95,6 +95,22 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend(openerp.EventDispatcherM
|
|||
}
|
||||
},
|
||||
|
||||
// compare groupby, ignoring the 'interval' attribute of dates...
|
||||
// this is necessary to avoid problems with the groupby received by the
|
||||
// context which do not have the interval attribute. This is ugly
|
||||
// and need to be changed at some point
|
||||
equal_groupby: function (groupby1, groupby2) {
|
||||
if (groupby1.length !== groupby2.length) { return false; }
|
||||
for (var i = 0; i < groupby1.length; i++) {
|
||||
if (!this.equal_value(groupby1[i], groupby2[i])) { return false; }
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
equal_value: function (val1, val2) {
|
||||
return ((val1.field === val2.field) && (val1.string === val2.string) && (val1.type === val2.type));
|
||||
},
|
||||
|
||||
create_field_value: function (f) {
|
||||
if (f.field && f.interval) {
|
||||
return { field:f.field,
|
||||
|
|
Loading…
Reference in New Issue