带工作流的 Odoo 8 覆盖按钮

Odoo 8 override button with workflow

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

这是它的样子:

<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' object has no attribute 'invoice_open

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

工作流程在设置菜单中仍然可见...

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

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

也许这可以帮助其他人在收到类似错误时也能找到他们的错误。谢谢