On 2018-01-22 00:55, Maxime Richez wrote:
> In domain definition, operand cannot be a field. So, i'm wondering how
> doing this kind of view: for example, a listing of all products having
> a cost_price greater than list price.
> I would define this domain ['cost_price', '>', Eval('list_price')] but
> this is not working.
> Another idea, was to define a function field on a boolean field (flag)
> and the setter of this function field will return true or false about
> the comparison between 'cost_price' and 'list_price'... and then
> creating a treeview with domain ['flag', '=' ,'True'] but once again,
> how to define a correct domain in the searcher function of the flag
> function field ?

For now, I think the Function field is the only option. The searcher
should probably have to return a clause like [('id', 'in', query)].
This is not optimal but it should work.

This is issue came up from time to time. I think it could be addresses
by extending the domain syntax. We will need to have a way to put a
column (with the option of being nested) as value. For example we could
have an object Field:

    [('cost_price', '>', Field('list_price'))]

I think on the client we could have this syntax:

    "Cost Price": > @"List Price"


-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20180123090822.GB4226%40kei.

Reply via email to