Remove states attribute of views and put it in py file

This commit is contained in:
Jes?s Mart?n Jim?nez 2016-07-22 14:28:52 +02:00
parent be24c4fdf8
commit 7ed42b47ba
2 changed files with 11 additions and 2 deletions

View File

@ -92,6 +92,16 @@ class Account:
breeding_accounts[fname] = new_account
return breeding_accounts
@classmethod
def view_attributes(cls):
res = super(Account, cls).view_attributes()
res += [
('/form/notebook/page[@id="breeding_accounts"]', 'states', {
'invisible': Not(Eval('is_breeding', False)),
}),
]
return res
class StockMove:
__name__ = 'stock.move'

View File

@ -8,8 +8,7 @@
<field name="is_breeding"/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']" position="after">
<page id="breeding_accounts" string="Breeding"
states="{'invisible': Not(Eval('is_breeding', False))}">
<page id="breeding_accounts" string="Breeding">
<label name="animals_account"/>
<field name="animals_account"/>
<label name="feed_account"/>