El 02/02/16 a les 10:16, Markus Bala ha escrit:
Hi All,
I had inherit 'stock.location', and add a new boolean field called
'staging'.
I try to change the original 'storage.location' field as below:
storage_location = fields.Many2One(
"stock.location", "Storage", states={
'invisible': Eval('type') != 'warehouse',
'readonly': ~Eval('active'),
'required': Eval('type') == 'warehouse',
},
domain=[
('type', 'in', ['storage', 'view']),*('staging','=', False),*
['OR',
('parent', 'child_of', [Eval('id')]),
('parent', '=', None)]],
depends=['type', 'active', 'id'])
At the domain, I add ('staging','=',False).
When I checked the result, seem like it do not override the field?
You should override the domain in the __setup__ method of your function.
Something like:
@classmethod
def __setup__(cls)
super(Class, cls).__setup__()
clause = ('staging', '=', False)
if clause not in cls.storage_location.domain:
cls.storage_location.domain.append(clause)
So this will modify the field when you module is loaded.
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
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/56B0758E.50600%40koolpi.com.