Hi Markus,

Am 12.04.2016 um 05:55 schrieb Markus Bala:
> Hi,
> 
> I had an inherit model ShipmentIn. Adding new field "order_confirm". The
> purpose when the order confirmed, other fields will be readonly.
> 
> How I am going to modify other fields base on the "order_confirm"?
> 
> Example:
> Original :
> company = fields.Many2One(.., states ={'readonly': Eval('state') !=
> 'draft'})
> 
> Expected:
> company = fields.Many2One(..., states = {'readonly': Eval('state') !=
> 'draft' | Eval('order_confirm') }
>
The "states" of each field are a dictionary with the keys "readonly",
"required" and "invisible". You can change it in the setup-classmethod:

@classmethod
def __setup__(cls):
    super(YOURCLASSNAME, cls).__setup__()
    cls.company.states['readonly'] = (Eval('state') != 'draft' |
Eval('order_confirm'))


I hope it helps in time

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/570C9CAD.7000602%40peschke-it.de.

Reply via email to