On 04/09/12 16:56 +0200, Udo Spallek wrote:
> Hi,
> 
> is there a way to use a fields.Reference in a domain clause of a
> fields.Many2One? E.g.
> 
> class Product(ModelSQL, ModelView):
>     _name = "product.product"
> 
>     picture_attachment = fields.Many2One('ir.attachment', 
>         'Picture Attachment', domain=[
>             ('type', '=', 'data'),
>             ('resource', '=', '%s,%s' % (_name, Eval('active_id'))),
>         ], help='Picture attachment')
> 
> Product()
> 
> The clause ('resource', '=', '%s,%s' % (_name, Eval('active_id')))
> does not find the expected resource(s) of model 'product.product'
> with active_id.
> 
> Ideas?

Since [1], you can use tuple.
And since [2], you can use «active_model» from the evaluation context.

[1] http://hg.tryton.org/trytond/rev/d276863f5924
[2] http://hg.tryton.org/tryton/rev/c7e8a50aef8c
-- 
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: pgpuLHZyxSfjU.pgp
Description: PGP signature

Reply via email to