On 2015-07-08 12:08, Jordi Esteve wrote: > On 07/07/15 23:59, Cédric Krier wrote: > >On 2015-07-07 23:38, Cédric Krier wrote: > >>On 2015-07-07 20:04, Jordi Esteve wrote: > >>>In sale and purchase modules the functional sales and purchases fields are > >>>defined on invoice model with a searcher method. > >>> > >>>If these fields are added in the invoice tree view and we search the > >>>invoices related to the SO001 sale, for example, I get this error SQL error > >>>because the sales id is compared with a string: > >>> > >>>ProgrammingError: operator does not exist: integer ~~* unknown > >>>LINE 1: ..."e" ON ("e"."id" = "d"."sale") WHERE (((("e"."id" ILIKE '%SO001 > >>>... > >>> ^ > >>>HINT: No operator matches the given name and argument type(s). You might > >>>need to add explicit type casts. > >>> > >>> > >>>The problem is the last .id in the domain of the searcher method. Removing > >>>'.id' the search works well: > >>> > >>> def search_sales(cls, name, clause): > >>> return [('lines.origin.sale*.id*',) + tuple(clause[1:]) + > >>>('sale.line',)] > >>> > >>>Tested in v3.4 but I think v3.6 and trunk have the same behaviour. > >>Won't fix. You should consider it as the behaviour of this function > >>field. > >Indeed now, the implementation of the searcher of many2one behaves the > >same as the searcher on one2many. So yes, removing the '.id' should > >allow to also use string as search value. > > Then, do I open an issue to remove the '.id' in searcher methods of sale and > purchase modules?
Yes please. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/