This question has been flagged
2 Replies
14373 Views

I'm having a problem when I try to overwrite the state of a button wich has a action on the name.

This button has this code:

<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="base.group_user"/>

What I want is just modify the old state to states='open,paid'  for the button apears on the paid and open states.

So I did this: 

<record model="ir.ui.view" id="account_invoice_update_journal_inherit">
        <field name="name">account.invoice.update.journal.inherit</field>
        <field name="model">account.invoice</field>
        <!--<field name="inherit_id"-->
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">

            <button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="base.group_user" position="replace">
            <button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,paid' groups="base.group_user"/>
          </button>

The problem I can't solve is this:

 raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: corp101_at_pt.action_account_invoice_refund" while parsing /usr/lib/python2.7/dist-packages/openerp/addons/corp101_at_pt/corp101_pt_saft_rules/inherit_views/account_invoice_inherit.xml:34, near
<record model="ir.ui.view" id="account_invoice_update_journal_inherit">
        <field name="name">account.invoice.update.journal.inherit</field>
        <field name="model">account.invoice</field>
        <!--<field name="inherit_id"-->
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">

            <data><button name="%(action_account_invoice_refund)d" type="action" string="Refund Invoice" states="open,proforma2,paid" groups="base.group_user" position="replace">
            <button name="%(action_account_invoice_refund)d" type="action" string="Refund Invoice" states="open,paid" groups="base.group_user"/>
          </button>

How can I solve this problem?

Best Regards

Avatar
Discard
Best Answer

Try using xpath 

        <xpath expr="//button[@string='Refund Invoice']" position="attributes">
            <attribute name="states">open,paid</attribute>
        </xpath>

Avatar
Discard
Author

thx atchuthan this resolve my problem :)

Best Answer

HI,

You have to write as like below.

<button name="%(account.action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="base.group_user" position="replace">
            <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,paid'             groups="base.group_user"/>
</button>

Because as like "inherit_id" we have to give the external_id into the %(xx)d format as like above.

So, just pass the external ID of it. Thats it. I hope you will get what you want.

Avatar
Discard
Author

hum... I did that but this dont fix the error it show the same "ParseError: "External ID not found in the system: acccount.action_account_invoice_refund""

Author

thx for the helping but the atchuthan resolve my problem

Author

thx for the helping but the atchuthan resolve my problem

I have jsut changed my answer. Just have a look and try it. It is also working.

This resolve the problem ;) <xpath expr="//button[@name='%(account.action_account_invoice_refund)d']" position="attributes"> True Work for me in odoo 9