Hi Markus,

Am 12.04.2016 um 09:09 schrieb Markus Bala:
> 
> 
> On Tue, Apr 12, 2016 at 1:58 PM, Ralf Peschke <rpesc...@peschke-it.de
> <mailto:rpesc...@peschke-it.de>> wrote:
> 
>     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
> 
> 
> Hi Ralf,
> 
> Thank you.
> 
> If let say I do not want to change the original state but only add the
> new condition. Is it possible?
> 
>     original_condition = cls.company.states['readonly']
>     cls.company.states['readonly'] =
> (original_condition  | Eval('order_confirm'))
> 

Yes, it is:
  cls.company.states['readonly'] =
    (cls.company.states.get('readonly', False) | Eval('order_confirm'))


-- 
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/570CA34E.3080707%40peschke-it.de.

Reply via email to