I am inheriting maintenance.request and adding four buttons on maintenance form. I only want to show one button at new request stage and all other three on the next stage. Any help would be appreciable.
XML:
<record model="ir.ui.view" id="maintenance_requests_inherit_view">
<field name="name">Maintenance Requests</field>
<field name="model">maintenance.request</field>
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='archive_equipment_request']" position="after">
<button string="Repaired" class="oe_highlight" type="object" name="on_repaired"> </button>
</xpath>
<xpath expr="//button[@name='archive_equipment_request']" position="after">
<button string="Inspect" class="oe_highlight" type="object" name="on_inspect"> </button>
</xpath>
<xpath expr="//button[@name='archive_equipment_request']" position="after">
<button string="Material Requisition" class="oe_highlight" type="object" name="on_material_requisition"> </button>
</xpath>
<xpath expr="//button[@name='archive_equipment_request']" position="after">
<button string="Invoice" class="oe_highlight" type="object" name="generate_invoice"> </button>
</xpath>
states attribute can't be used here because states are not declared in source maintenance model as a Selection field.
maintenance_stage.py