[FIX] forbid dropping templates databases
[FIX] res_partner: name_search search in one pass

The original query did two passes (SQL query and orm search). This was a problem due to the limit parameter where the second query could reduce the number of results to a smaller number than the asked limit.

This code reproduces the orm _search behaviour to execute only one SQL query mixing both the ACL clauses and the complexe name_search without degrading the performances (removing the limit in the first query would have).
[IMP] remove useless variable, where_clause at least '' as created from a str.join()
[FIX] revert previous rev for better where and add test
[ref] move up!
[FIX] better test, add missing parentheses in query, return empty list in case of no idea (instead of triggering super)
[IMP] make sure the records will be in right order (and trigger chirurgiens-dentistes.fr for the second name_search)
[MERGE] [FIX] res_partner: name_search search in one pass

The original query did two passes (SQL query and orm search). This was a problem due to the limit parameter where the second query could reduce the number of results to a smaller number than the asked limit.

This code reproduces the orm _search behaviour to execute only one SQL query mixing both the ACL clauses and the complexe name_search without degrading the performances (removing the limit in the first query would have).
[MERGE] forward port of branch 7.0 up to revid 5216 mat@openerp.com-20140129132240-eamnzs37k0i65gpe
[MERGE] forward port of branch saas-2 up to revid 5006 chs@openerp.com-20140129140159-9vwkpr078shoonum
Merge branch 'master' of bzr::lp:openobject-server