summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2014-04-03 16:35:34 +0200
committerGery Debongnie <ged@openerp.com>2014-04-03 16:35:34 +0200
commit9d915db2144be0d3b8e01340495f45b4187ceb76 (patch)
treeefbe4972027cd2317dd1cc2414426d521150cffe /addons/web/static/src/js/data.js
parent0d4732b5c4194c7c25a13266dfdd1aed05e534eb (diff)
[FIX] read_group has been changed to return the results with field:interval as key (for example, date_deadline:week), to avoid name collisions. This commit changes the web client to make sure it properly processes the new result format. No change at all for queries that do not use the field:interval format (addon web)
bzr revid: ged@openerp.com-20140403143534-3jpugw9g8n966n9t
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 413d0621011..9d11dbcf2a8 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -238,31 +238,26 @@ instance.web.QueryGroup = instance.web.Class.extend({
{__context: {group_by: []}, __domain: []},
read_group_group);
- var raw_fields = _.map(grouping_fields, function (field) {
- return field && field.split(':')[0];
- });
-
-
+ var count_key = (grouping_fields[0] && grouping_fields[0].split(':')[0]) + '_count';
var aggregates = {};
_(fixed_group).each(function (value, key) {
if (key.indexOf('__') === 0
- || _.contains(raw_fields, key)
- || (key === raw_fields[0] + '_count')) {
+ || _.contains(grouping_fields, key)
+ || (key === count_key)) {
return;
}
aggregates[key] = value || 0;
});
-
this.model = new instance.web.Model(
model, fixed_group.__context, fixed_group.__domain);
- var group_size = fixed_group[raw_fields[0] + '_count'] || fixed_group.__count || 0;
+ var group_size = fixed_group[count_key] || fixed_group.__count || 0;
var leaf_group = fixed_group.__context.group_by.length === 0;
var value = (grouping_fields.length === 1)
- ? fixed_group[raw_fields[0]]
- : _.map(raw_fields, function (field) { return fixed_group[field]; });
+ ? fixed_group[grouping_fields[0]]
+ : _.map(grouping_fields, function (field) { return fixed_group[field]; });
var grouped_on = (grouping_fields.length === 1)
? grouping_fields[0]
: grouping_fields;