Tryton, form state change with Eval not working with custom field (+ fix)

(0 comments)

I added a Boolean field to SaleLine - one that is not shown to the user but only set in the code as a flag. As the readonly state of just about all my custom fields should depend on that I added:

states = {'readonly': ((Eval('sale_state') != 'draft') |
                 Eval('real_product')), 
 }, 

Frustratingly it did not work even though the rest of my code was executed in on_change_product as was seen on the assignment of values.

Took me a while to figure out what the problem was .. apparently for Eval('real_product') to work I needed to add this field to my sale_line_form.xml. So I did just that and to not show it to the user of course added states = { 'invisible': True, } to my Boolean field. Simple when you know it .. but takes a while to figure out if you don't.

Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

Recent Posts

Archive

2023
2022
2021
2020
2019
2018
2014
2012
2011
2010
2009
2008
2007

Categories

Authors

Feeds

RSS / Atom