Odoo Help

0

overwrite button states

By
Francisco Castro
on 1/5/15, 6:26 AM 3,730 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

0

Try using xpath 

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

thx atchuthan this resolve my problem :)

Francisco Castro
on 1/5/15, 7:31 AM
0

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.

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""

Francisco Castro
on 1/5/15, 7:28 AM

thx for the helping but the atchuthan resolve my problem

Francisco Castro
on 1/5/15, 7:31 AM

thx for the helping but the atchuthan resolve my problem

Francisco Castro
on 1/5/15, 7:31 AM

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

Emipro Technologies Pvt. Ltd.
on 1/5/15, 7:55 AM

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

Dany Lopez
on 1/3/16, 12:55 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/5/15, 6:26 AM
Seen: 3730 times
Last updated: 3/16/15, 8:10 AM