mirror of
https://github.com/NaN-tic/trytond-asset_elevator.git
synced 2023-12-14 05:12:52 +01:00
Use cls.view_attributes() to define states in views
This commit is contained in:
parent
ca24139d27
commit
aef47441f4
13
asset.py
13
asset.py
|
@ -340,3 +340,16 @@ class Asset:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_conductors_connection():
|
def default_conductors_connection():
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def view_attributes(cls):
|
||||||
|
res = super(Asset, cls).view_attributes()
|
||||||
|
res += [
|
||||||
|
('/form/separator[@id="elevator"]', 'states', {
|
||||||
|
'invisible': Eval('type') != 'elevator',
|
||||||
|
}),
|
||||||
|
('/form/notebook/page[@id="components"]', 'states', {
|
||||||
|
'invisible': Eval('type') != 'elevator',
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
return res
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
copyright notices and license terms. -->
|
copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="/form/notebook" position="before">
|
<xpath expr="/form/notebook" position="before">
|
||||||
<separator id="elevator" string="Elevator Info" states="{'invisible': Eval('type') != 'elevator'}" colspan="4"/>
|
<separator id="elevator" string="Elevator Info" colspan="4"/>
|
||||||
<group col="6" colspan="4" id="elevator_info">
|
<group col="6" colspan="4" id="elevator_info">
|
||||||
<label name="elevator_type"/>
|
<label name="elevator_type"/>
|
||||||
<field name="elevator_type"/>
|
<field name="elevator_type"/>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/form/notebook" position="inside">
|
<xpath expr="/form/notebook" position="inside">
|
||||||
<page id="components" string="Components" col="2" states="{'invisible': Eval('type') != 'elevator'}">
|
<page id="components" string="Components" col="2">
|
||||||
<group id="doors_limiter" col="1">
|
<group id="doors_limiter" col="1">
|
||||||
<group id="doors" col="2">
|
<group id="doors" col="2">
|
||||||
<separator id="doors" string="Doors" colspan="2"/>
|
<separator id="doors" string="Doors" colspan="2"/>
|
||||||
|
|
Loading…
Reference in a new issue