Thank you Cedric for your comments.
I have just tried but it doesn't work. Maybe because i missed something
else.
At least i know i am on the right direction based on your comment.
I just want to mention by some details as i thought maybe i wasn't  able to
explain it correctly.

class model1()
_name='company.model1'
*multiprice *= fields.Boolean("Multi Price allowed?
mod2 = fields.one2many(model2 ...etc...)

class model2()
_name='company.model2'
mod1ref = fields.many2one(model1 , ...etc...)
mod3 = fields.one2many(model3 .... etc ...)


class model3()
mod2ref = fields.many2one(model1, ...etc,....)
FF = fields.Boolean("FF" , states=STATES)

STATES = {
           'invisible' : Bool(Eval('_parent_model1.*multiprice*')),
           }

Actually i want to make this field invisible based on the value from parent
of his parent.
I tried the sample code it seems that it always return "True" value.
As i tested before, Even if i  put some loblob instead of multi price. It
also returns True.
Just to ask whether this is because of some small tips, For example i'm
writing classless in different files (.py).
was it the cause of such problems ?
I have been spending an entire of the last week to find a solution for this
simple looking problem by reviewing docs and codes of other modules. [?]
Thanks,

On Tue, Sep 7, 2010 at 2:10 PM, Cédric Krier <[email protected]> wrote:

> 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/
>

-- 
[email protected] mailing list

<<323.gif>>

Reply via email to