On 16/06/12 02:31 -0700, guly200 wrote:
> 
> I'm scratching my head on a problem with domains o_O Hope someone can help 
> me:
> 
> Let's say I have a field like this:
> 
>     leader = fields.Many2One('res.user', 'leader', domain=mydomain)
> 
> and I would like 'mydomain' to limit users to those belonging to a group. 
> It would look like this:
> 
>     mydomain = [('groups', 'contains', Id('sale', 'group_sale'))]
>     but operator "contains" is not implemented 
> 
> so I tried:
> 
>     mydomain = [('groups', 'child_of', Id('sale', 'group_sale'), 'user')] 
> according to documentation 
> http://doc.tryton.org/2.4/trytond/doc/topics/domain.html?highlight=child_of#child-of
>     but it's a many2many with relations on a third table so I think 
> documentation is wrong ? 
> 
> 
> Does anybody know how to write mydomain to get the expected result ?

Normally, this should work:

    [('groups', '=', Id('sale', 'group_sale'))]

The equals operator on many2many means "if at least one value equals to"

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgp21BJJMfpeB.pgp
Description: PGP signature

Reply via email to