[IMP] graph_view now properly honors the 'interval' attribute of field names in the xml description (addon web_graph)

bzr revid: ged@openerp.com-20140124084222-dq1gpg1tg8rinozx
This commit is contained in:
Gery Debongnie 2014-01-24 09:42:22 +01:00
parent 59b75a0176
commit 29d08d9a6b
2 changed files with 10 additions and 5 deletions

View File

@ -47,23 +47,27 @@ instance.web_graph.GraphView = instance.web.View.extend({
};
_.each(arch.children, function (field) {
var field_name = field.attrs.name;
if (_.has(field.attrs, 'interval')) {
field_name = field.attrs.name + ':' + field.attrs.interval;
}
if (_.has(field.attrs, 'type')) {
switch (field.attrs.type) {
case 'row':
self.widget_config.row_groupby.push(field.attrs.name);
self.widget_config.row_groupby.push(field_name);
break;
case 'col':
self.widget_config.col_groupby.push(field.attrs.name);
self.widget_config.col_groupby.push(field_name);
break;
case 'measure':
self.widget_config.measures.push(field.attrs.name);
self.widget_config.measures.push(field_name);
break;
}
} else { // old style, kept for backward compatibility
if ('operator' in field.attrs) {
self.widget_config.measures.push(field.attrs.name);
self.widget_config.measures.push(field_name);
} else {
self.widget_config.row_groupby.push(field.attrs.name);
self.widget_config.row_groupby.push(field_name);
}
}
});

View File

@ -281,6 +281,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
if (!this.important_fields.length) {
return;
}
var fields = _.map(this.important_fields, function (field) {
return {id: field.field, value: field.string, type:self.fields[field.field].type};
});