【问题标题】:How does this OpenERP button work这个 OpenERP 按钮是如何工作的
【发布时间】:2014-01-16 10:34:02
【问题描述】:

我在 OpenERP xml 视图中遇到了一些代码,但我无法理解它是如何工作的。

<button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
  • % 是什么意思
  • 最后的 d 是什么?
  • 为什么会有账户(点)action_account_invoice_refund

系统中没有调用account_invoice_refund的方法,但是有一个类:

class account_invoice_refund(osv.osv_memory):

调用方法的传统按钮如下所示:

<button name="invoice_cancel" states="proforma2,open" string="Cancel" icon="gtk-cancel"/>

【问题讨论】:

  • 我认为这个问题与stackoverflow.com/questions/14682253/…重复
  • 链接的问题说,除非它是工作流(默认),否则类型必须是对象或操作。上面的 invoice_cancel 按钮调用 python 代码但没有 type=object
  • 如果按钮从工作流中调用,那么它就是动作对象

标签: openerp


【解决方案1】:

按钮类型是action类型,所以会触发一个action,由module.xml_id调用。

因此它将在帐户模块中搜索名为 action_account_invoice_refund 的操作 xml 视图

该操作将在帐户模块的向导文件夹中找到

使用grep函数查找xml

例如:

使用 grep -rn "action_account_invoice_refund" 。在帐户模块文件夹中

它会显示

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-27
    • 1970-01-01
    • 2013-12-22
    • 2018-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多