Xavier ALT (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/6.1-opw-574218-xal into lp:openerp-web/6.1.
Requested reviews:
Xavier (Open ERP) (xmo)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-574218-xal/+merge/107377
Hi,
This branch fix a performance problem on many2one field when click on "Search
More" without search value and the related model have many records in the DB.
Steps:
- Create a new DB with ~10 000 products
- Create a new Sale Order
- When creating the first sale order line, click inside the "Product" field,
then on "Search More"
Current: System is taking many many seconds to display the search box
Expect: System should display it instantly as there is not prefiltering to be
done.
Cheers,
Xavier
--
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-opw-574218-xal/+merge/107377
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/6.1-opw-574218-xal.
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-05-16 14:42:16 +0000
+++ addons/web/static/src/js/view_form.js 2012-05-25 13:26:18 +0000
@@ -2056,11 +2056,20 @@
if (values.length > self.limit) {
values = values.slice(0, self.limit);
values.push({label: _t("<em> Search More...</em>"), action: function() {
- dataset.name_search(search_val, self.build_domain(), 'ilike'
- , false, function(data) {
+ if (search_val.length == 0) {
+ // search optimisation - in case user didn't enter any text we
+ // do not need to prefilter records; for big datasets (ex: more
+ // that 10.000 records) calling name_search() could be very very
+ // expensive!
self._change_int_value(null);
- self._search_create_popup("search", data);
- });
+ self._search_create_popup("search", undefined);
+ } else {
+ dataset.name_search(search_val, self.build_domain(), 'ilike'
+ , false, function(data) {
+ self._change_int_value(null);
+ self._search_create_popup("search", data);
+ });
+ }
}});
}
// quick create
_______________________________________________
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