[FIX] correctly take in account default group_by (from action context)
authorXavier Morel <xmo@openerp.com>
Mon, 12 Dec 2011 14:16:56 +0000 (15:16 +0100)
committerXavier Morel <xmo@openerp.com>
Mon, 12 Dec 2011 14:16:56 +0000 (15:16 +0100)
group_by are alternative: use the one from the search view if there is one
otherwise use the one from the action
and default is no group by

lp bug: https://launchpad.net/bugs/902302 fixed

bzr revid: xmo@openerp.com-20111212141656-w41nnfhzw9kcu93k

addons/web/static/src/js/views.js

index f983cd7..ac1451c 100644 (file)
@@ -346,15 +346,19 @@ session.web.ViewManager =  session.web.Widget.extend(/** @lends session.web.View
     },
     do_searchview_search: function(domains, contexts, groupbys) {
         var self = this,
-            controller = this.views[this.active_view].controller;
+            controller = this.views[this.active_view].controller,
+            action_context = this.action.context || {};
         this.rpc('/web/session/eval_domain_and_context', {
             domains: [this.action.domain || []].concat(domains || []),
-            contexts: [this.action.context || {}].concat(contexts || []),
+            contexts: [action_context].concat(contexts || []),
             group_by_seq: groupbys || []
         }, function (results) {
             self.dataset.context = results.context;
             self.dataset.domain = results.domain;
-            controller.do_search(results.domain, results.context, results.group_by);
+            var groupby = results.group_by.length
+                        ? results.group_by
+                        : action_context.group_by;
+            controller.do_search(results.domain, results.context, groupby || []);
         });
     },
     /**