Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-340386-msh into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-340386-msh/+merge/88451

Hello,

Fixed the issue of group by when there is list of groups in filter.

Demo : Accounting -> Reporting -> Statistic Reports -> Entries Analysis -> do 
group by product, you will get a traceback which will describes that nonetype 
object has no attribute get.

Reason :- When there is a code in filter like <filter string="Product" 
icon="terp-accessories-archiver" 
context="{'group_by':['product_id','product_uom_id'], 'quantity_visible':1}"/>

so here you can see there is list of group ['product_id','product_uom_id'] so 
when we click on product the group_by_ctx will be sent to server as "user_type, 
['product_id','product_uom_id']" and in server we have split the group_by_ctx 
string by ',' so we will get three group.
1.user_type
2.['product_id'
3.'product_uom_id']

Here you can see group 2 & 3 is not a valid group so this causing an issue.

So changed the code accordingly.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-340386-msh/+merge/88451
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-340386-msh.
=== modified file 'addons/openerp/static/javascript/search.js'
--- addons/openerp/static/javascript/search.js	2011-07-27 11:03:26 +0000
+++ addons/openerp/static/javascript/search.js	2012-01-13 07:31:26 +0000
@@ -474,10 +474,12 @@
     var all_boxes = [];
     var $filter_list = jQuery('#filter_list');
     var domain = '[]';
+    var re = /\[|\]|\'/g;
     if (jQuery('div.group-data').length) {
         jQuery('div.group-data button').each(function(){
             if (jQuery(this).hasClass('active')) {
                 var _grp = jQuery(this).next('input').attr('group_by_ctx');
+               	_grp = _grp.replace(re,'');
                 if (jQuery.inArray(_grp, group_by) < 0) {
                     group_by.push(_grp);
                 }
@@ -509,7 +511,9 @@
             jQuery(src).attr('checked', true);
             if($source.attr('group_by_ctx') &&
                $source.attr('group_by_ctx') != 'False') {
-                group_by.push($source.attr('group_by_ctx'));
+               group_by_ctx = $source.attr('group_by_ctx')
+               group_by_ctx = group_by_ctx.replace(re,'');
+               group_by.push(group_by_ctx);
             }
 
             if($source.attr('filter_context') &&

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to