El 27/06/14 18:03, Mark Hayden ha escrit:
Hi all,

I have a function field where I need to write a searcher function that must do 
a search that cannot be expressed in a domain. The docs say that a SQL 
statement can be specified in the operand but I could not find anywhere an 
example of this being done.
You must return a domain, to be parsed by the search function. This can be quite simple [1] or a little bit more complex [2].

Is the SQL statement a string or an actual "python-sql" type object? Also what 
would you then put in the other two parts of the domain you return, or do you return the 
SQL statement instead of a domain? Or is it done with the 'in' operator?....
I will recomend using python-sql. On complex query normaly you return [('id', 'in', query)], and the query returns all the id that match the search criteria.

Hope it helps.


[1] http://hg.tryton.org/modules/purchase/file/63e774884da0/invoice.py#l77
[2] http://hg.tryton.org/modules/account_payment/file/942da2fb7a49/account.py#l72

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Reply via email to