跳至內容
選單
此問題已被標幟
2 回覆
15656 瀏覽次數

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

頭像
捨棄
最佳答案

Try using xpath 

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

頭像
捨棄
作者

thx atchuthan this resolve my problem :)

最佳答案

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

作者

thx for the helping but the atchuthan resolve my problem

作者

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

相關帖文 回覆 瀏覽次數 活動
1
8月 19
6711
3
10月 24
14433
2
3月 23
10085
2
3月 23
2473
1
8月 22
15298