繁体   English   中英

Odoo 8覆盖按钮与工作流程

[英]Odoo 8 override button with workflow

我想覆盖会计 - >客户发票 - >发票中的“验证”按钮。 我只想更改可见性组(仅用于客户退款)。

这是它的样子:

<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'), '&amp;', ('type', '!=', 'out_refund'), ('state','not in',('draft',))]}"
            groups="base.group_user" />

    </xpath>

  </field>

该按钮已被替换,但工作流'invoice_open'现在似乎未知。 单击按钮时,我收到错误消息AttributeError:'account.invoice'对象没有属性'invoice_open

你能帮我解决一下Odoo8吗? (我已经为Odoo10尝试了它并且它有效...唯一的区别是,按钮名称是'action_invoice_open'并且它在python而不是工作流中触发了一个方法 - 但我需要它用于Odoo8)

工作流程仍在设置菜单中可见... 在此输入图像描述

我刚刚发现我的错误:) - 因为我也尝试过Odoo 10,我使用了错误的按钮类型为Odoo8。

在调用工作流时,按钮类型必须是workflow而不是object

也许这有助于其他人在收到类似错误时发现错误。 谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM