[FIX] incorrect handling of saved filter group_by when not present or an array
authorXavier Morel <xmo@openerp.com>
Tue, 21 Feb 2012 14:05:17 +0000 (15:05 +0100)
committerXavier Morel <xmo@openerp.com>
Tue, 21 Feb 2012 14:05:17 +0000 (15:05 +0100)
bzr revid: xmo@openerp.com-20120221140517-fs0axg9w8irapw06

addons/web/static/src/js/search.js

index 74ae657..2809b37 100644 (file)
@@ -263,9 +263,14 @@ openerp.web.SearchView = openerp.web.OldWidget.extend(/** @lends openerp.web.Sea
             var filter = this.managed_filters[val];
             this.do_clear(false).then(_.bind(function() {
                 select.val('get:' + val);
-                var groupbys = _.map(filter.context.group_by.split(","), function(el) {
-                    return {"group_by": el};
-                });
+
+                var groupbys = [];
+                var group_by = filter.context.group_by;
+                if (group_by) {
+                    groupbys = _.map(
+                        group_by instanceof Array ? group_by : group_by.split(','),
+                        function (el) { return { group_by: el }; });
+                }
                 this.on_search([filter.domain], [filter.context], groupbys);
             }, this));
         } else {