On 06/09/10 22:59 -0700, Mohammad wrote:
> Hi everybody.
> I'm almost new in Tryton. While writing a module, i encountered a
> problem. I don't know to to make a field invisible based on the other
> field.
> Of course we can do it simply by a code like this:
>
> states={
> invisible: Not(Bool(Eval(otherfield)))
> }
>
>
> But, Here i developed a module with a single view but with 3 child
> model.
> I mean for example there is a model named model1 which has a
> relationnal OneToMany field (model 2).
> And in model 2 i have another relational One2many to model3.
> The view implemented using model1 and 2 and 3.
> Lets say we plan to change a field within the third level (which is
> belong to model3) based on the checkbox in the model1 (parent of the
> parent model) within the same Formview.
>
> I tried to put something like this:
>
> states={
> invisible: Not(Bool(Eval(model1.otherfield)))
> }
>
> It didn't work in my system. nether this nor any other ideas based on
> this technique .
> I thought i missed some part of programming and concept of
> implementing a model and decided to ask it.
You must use:
Eval('_parent_model1.otherfield')
I know it is a little bit strange and perhaps we could improve it.
The main issue is that if you use simply "Eval('model1')", you should expect
to be evaluated with the id.
--
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/
pgpfOtzNrA4NM.pgp
Description: PGP signature
