Thanks again.
I have to spend more as it didn't work again.
I even found some sample within the tryton code based on your
comments(sale line 960)
surprisingly my module works fine and fields can be visible or enable
based on the other fields on the same model.
I have got this error when i want to change child fields as well. for
example changing a field in the parent based on the child field.
As referring to the exact field in the child model doesn't work, I put
only a name of the one2many field to refer to this model.
Therefore when a user tries to add anything to the child model it
triggers visibility of the fields in the parent model.
i did some changes inside the module maybe the error was because of
them.

Name of the relational fields are not the same as the class (unlike
all the examples of Tryton like sale.py)

I change the def module of the sub class to this :
  def create(self, cursor, user, values, context=None):
        #vals['code_length'] = len(vals['code'])
        val = values.copy()
        val['active'] = True
        return super(product_price_list_main, self).create(cursor,
user, val, context=context)

rec_name is generated dynamically.

There are lots of underline "_" in my classes name.

It's very strange for beginners like me.

I hope one of the above information was the cause of error.
Otherwise i really get confused as i don't have anything to change !
Regards.




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...)

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

But still having problem


On Sep 7, 3:25 pm, Cédric Krier <[email protected]> wrote:
> On 07/09/10 15:15 +0800, Seyed Mohammad Motahar wrote:
>
>
>
>
>
> > 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*')),
> >            }
>
> It mus be:
>
>     Bool(Eval('_parent_model2._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.
>
> If Eval doesn't find the field then it uses the default one. This allow to
> have always a result (without exception).
>
> > 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 ?
>
> No.
>
> --
> 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/
>
>  application_pgp-signature_part
> < 1KViewDownload

-- 
[email protected] mailing list

Reply via email to