El jueves, 19 de noviembre de 2015, 14:15:51 (UTC), Sergi Almacellas 
Abellana escribió:
>
> El 19/11/15 a les 12:04, Antonio Roncero ha escrit: 
> > Hi, 
> > 
> > In a particular case, i need to make invisible the name field on the 
> > party model and use only code field. In this case i need to make visible 
> > a page. I use the classmethod view_attributes 
> > 
> > | 
> > 
> > @classmethod 
> > defview_attributes(cls): 
> > return[('/form//field[@name="name"]','states',{ 
> > 'invisible':Eval('is_robot'), 
> > }), 
> > ('//page[@id="party_robot_data"]','states',{ 
> > 'invisible':~Eval('is_robot'), 
> > }), 
> > ] 
> > 
> > | 
> > 
> > The second part works fine, but the field "name" not change. I tried 
> > with /form/field[@name="name"] 
> > /form//field[@name="name"] //form/field[@name="name"] 
> > //field[@name="name"] /field[@name="name"]... 
> > I don't know if I am writing bad the xpath or there is another error 
> > 
>
> Why are you only setting the states on the view and not on the field? I 
> will override the states on name field, on the __setup__ function, so 
> it's applied to all the views. 
>
> Also make sure that the is_robot field is added to the name depends, so 
> the client will always fetch the is_robot field. 
>
> Really because I still am in the learning phase, so I don't know all the 
framework possibilities (I don't find to much doc and I'm reading a lot of 
other people modules). :P
But that code must be work, no? The second part makes the changes, the 
first part doesn't anything...
 

> Hope it helps. 
>
>
Sure!
 

>
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/cd7d8d34-56ea-456f-84ef-ad946614f9b9%40googlegroups.com.

Reply via email to