A solution to give an order of magnitude performance speed would be:
a) create a "name_with_company" stored function field on res_partner to avoid
the join;
b) create an expression index[1] on "lower(name_with_company)";
c) change the query to use ('lower(%s) like lower(name_with_company)') for
("name","ilike") name_search (about 99% of the case)
d) keep the self.search to apply the record rules - the IN on the database side
is a cheap query.
[1] http://www.postgresql.org/docs/9.1/static/indexes-expressional.html
--
https://code.launchpad.net/~openerp-community/openobject-server/fix-1094212-multicompany-res_partner/+merge/141936
Your team OpenERP Community is subscribed to branch
lp:~openerp-community/openobject-server/fix-1094212-multicompany-res_partner.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-community
More help : https://help.launchpad.net/ListHelp