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.
Comments
There are currently no comments
New Comment