我想覆盖会计 - >客户发票 - >发票中的“验证”按钮 . 我只想更改可见性组(仅用于客户退款) .
这是它的样子:
<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)
工作流程仍在设置菜单中可见...
1 回答
我刚刚发现我的错误:) - 因为我也尝试过Odoo 10,我使用错误的按钮类型为Odoo8 .
在调用工作流时,按钮类型必须是
workflow
而不是object
.也许这有助于其他人在收到类似错误时发现错误 . 谢谢 .