Chris Biersbach (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/6.1-opw-581785-cbi into lp:openerp-web/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-581785-cbi/+merge/134066
The bug that was encountered: When sorting by product on pricelist versions,
you get a wrong order.
The reason: The web client does this by comapring using < and >. If the field
is a many2one (as in this case), its value is an array [id, name]. Thus, using
< and > on arrays does a comapre on the first element first. The products are
does sorted by id, and not by name.
The fix: This introduces a check to see whether the field is a many2one field.
In that case, I explicitly do a compare of the 2nd element in the array to
correctly sort by name.
--
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-581785-cbi/+merge/134066
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/6.1-opw-581785-cbi.
=== modified file 'addons/web/static/src/js/data.js'
--- addons/web/static/src/js/data.js 2012-09-06 12:48:16 +0000
+++ addons/web/static/src/js/data.js 2012-11-13 10:18:21 +0000
@@ -756,6 +756,11 @@
sign = -1;
field = field.slice(1);
}
+ // very thorough test to check whether this is a o2m field
+ check_m2o = function(f) {
+ return f[field] instanceof Array && f[field].length == 2 && typeof(f[field][0]) == 'number' && typeof(f[field][1]) == 'string';
+ }
+ if (check_m2o(a) && check_m2o(b)) return sign * compare(a[field][1], b[field][1])
return sign * compare(a[field], b[field]);
}, 0);
});
_______________________________________________
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