Odoo Help

Welcome!

This community 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.

0

overwrite button states

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

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3883
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 1/5/15, 7:24 AM

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

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/5/15, 7:20 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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