Hey, so we have added a state system to an existing module in our odoo installation.
However i cant seem to make the approve button only appear if its in draft with a name set.
Here is what ive tried:
<xpath expr="//div[@name='button_box']/.." position="before">
<header>
<xpath expr="//field[@name='name']">
<button name="action_approve_contract" type="object" string="Approve Contract" state="draft" confirm="Please make sure you have checked all the information on this contract before approving it." domain="[('name', '!=', False)]"/>
<button name="action_contract_send" type="object" string="Send by Email" groups="base.group_user" state="approved"/>
</xpath>
<field name="x_state" widget="statusbar" statusbar_visible="draft,approved,sent,cancel,expired"/>
</header>
</xpath>
The result of this is that both of the buttons arent showing at all, regardless of state and name field data.
Inheritance in model and views: https://goo.gl/4Zyc9d