【发布时间】:2017-07-05 13:48:39
【问题描述】:
我想覆盖会计 -> 客户发票 -> 发票中的“验证”按钮。我只想更改可见性组(仅用于客户退款)。
如下所示:
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="/form/header/button[@name='invoice_open' and @states='draft']" position="replace">
<!-- Show validate button inside invoice of type out_refund only, if in state draft + group_customer_refund_manager -->
<button name="invoice_open" type="object" string="Validate" class="oe_highlight"
attrs="{'invisible': ['|',('type', '!=', 'out_refund'), ('state','not in',('draft',))]}"
groups="account.group_customer_refund_manager"/>
<!-- Show validate button inside invoice of type !out_refund if state in draft -->
<button name="invoice_open" type="object" string="Validate" class="oe_highlight"
attrs="{'invisible': ['|',('type', '=', 'out_refund'), '&', ('type', '!=', 'out_refund'), ('state','not in',('draft',))]}"
groups="base.group_user" />
</xpath>
</field>
按钮已被替换,但工作流“invoice_open”现在似乎未知。单击按钮时,我收到错误消息 AttributeError: 'account.invoice' object has no attribute 'invoice_open
你能帮我为 Odoo8 解决这个问题吗? (我已经为 Odoo10 尝试过它并且它有效......唯一的区别是,按钮名称是“action_invoice_open”,它触发了 python 中的方法而不是工作流 - 但我需要它用于 Odoo8)
【问题讨论】: