【问题标题】:Odoo 8 override button with workflow带有工作流程的 Odoo 8 覆盖按钮
【发布时间】: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'), '&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)

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

【问题讨论】:

    标签: xml openerp odoo-8


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      相关资源
      最近更新 更多