Skip to Content
Menu
This question has been flagged
1 Reply
4420 Views

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 &amp; 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 &amp; 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?

Avatar
Discard
Author Best Answer

There was some conflicting code which made this code to not work properly. I identified that and fixed it, it was a silly mistake.

Anyhow just for the refernece,

<xpath expr="//button[@name='action_invoice_open']" position="replace">

The above xpath works perfectly fine.

Thank you.

Avatar
Discard
Related Posts Replies Views Activity
0
Aug 21
2402
5
Aug 19
8013
3
Apr 19
5380
3
Apr 21
6444
2
Jun 20
4207