Hi,
I want to override the action_invoice_open button's functionality from the below code
<form string="Invoice" class="o_invoice_form">
<header>
<button name="action_invoice_sent" string="Send & Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', 'not in', ('open','in_payment','paid'))]}" class="oe_highlight" groups="base.group_user"/>
<button name="action_invoice_sent" string="Send & Print" type="object" attrs="{'invisible':['|',('sent','=',False), ('state', 'not in', ('open','in_payment','paid'))]}" groups="base.group_user"/>
<button name="%(action_account_invoice_payment)d" id="account_invoice_payment_btn" type="action"
attrs="{'invisible': [('state', '!=', 'open')]}"
string="Register Payment" groups="account.group_account_invoice" class="oe_highlight"/>
<button name="action_invoice_open" type="object" states="draft" string="Validate" class="oe_highlight o_invoice_validate" groups="account.group_account_invoice"/>
So i've inherited the button and tried overriding the functionality like this but it doesn't work. Can anyone tell me why?
<record model="ir.ui.view" id="invoice_form_inherited">
<field name="name">account.invoice.view.form.inherit.account</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_invoice_open']" position="replace">
<button name="action_invoice_open" type="object" states="draft" string="Test Validate" class="oe_highlight o_invoice_validate" groups="account.group_account_invoice"/>
</xpath>
</field>
</record>
I have also tried using xpath as
<xpath expr="/form/header/button[@name='action_invoice_open']" position="replace">
and
<xpath expr="/form/header[1]/button[@name='action_invoice_open']" position="replace">
but none of them worked. Why is this happening, am i missing something here?