summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-04-16 11:23:44 +0200
committerXavier Morel <xmo@openerp.com>2013-04-16 11:23:44 +0200
commita455d6c2b27fb8a90c8993abb176da64c0952b5c (patch)
treeaba912449bff409e7f7773bd163c18d814aa2661 /addons/web/static/src
parentd7b63202f3716179062365e1c6cf8178617fd012 (diff)
[FIX] correctly handle group_by_no_leaf when no grouping applied
If there are no grouping field specified *but* group_by_no_leaf is specified, should call read_group with no grouping fields: will generate a single group (which can not be opened) for all of the model. Necessary for analysis views since individual "records" make no sense. bzr revid: xmo@openerp.com-20130416092344-2pqog8f7xprn6hsh
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/data.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index cfcd86307ba..a36441add1c 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -112,24 +112,27 @@ instance.web.Query = instance.web.Class.extend({
* @returns {jQuery.Deferred<Array<openerp.web.QueryGroup>> | null}
*/
group_by: function (grouping) {
- if (grouping === undefined) {
- return null;
+ var ctx = instance.web.pyeval.eval(
+ 'context', this._model.context(this._context));
+
+ // undefined passed in explicitly (!)
+ if (_.isUndefined(grouping)) {
+ grouping = [];
}
if (!(grouping instanceof Array)) {
grouping = _.toArray(arguments);
}
- if (_.isEmpty(grouping)) { return null; }
+ if (_.isEmpty(grouping) && !ctx['group_by_no_leaf']) {
+ return null;
+ }
var self = this;
-
- var ctx = instance.web.pyeval.eval(
- 'context', this._model.context(this._context));
return this._model.call('read_group', {
groupby: grouping,
fields: _.uniq(grouping.concat(this._fields || [])),
domain: this._model.domain(this._filter),
- context: this._model.context(this._context),
+ context: ctx,
offset: this._offset,
limit: this._limit,
orderby: instance.web.serialize_sort(this._order_by) || false
@@ -325,7 +328,7 @@ instance.web.Model = instance.web.Class.extend({
* Fetches the model's domain, combined with the provided domain if any
*
* @param {Array} [domain] to combine with the model's internal domain
- * @returns The model's internal domain, or the AND-ed union of the model's internal domain and the provided domain
+ * @returns {instance.web.CompoundDomain} The model's internal domain, or the AND-ed union of the model's internal domain and the provided domain
*/
domain: function (domain) {
if (!domain) { return this._domain; }
@@ -337,7 +340,7 @@ instance.web.Model = instance.web.Class.extend({
* combined with the provided context if any
*
* @param {Object} [context] to combine with the model's internal context
- * @returns The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
+ * @returns {instance.web.CompoundContext} The union of the user's context and the model's internal context, as well as the provided context if any. In that order.
*/
context: function (context) {
return new instance.web.CompoundContext(