name of type=“action” in openerp button

南楼画角 提交于 2019-12-06 07:15:43

问题


I've a problem when I want to make button in type="action", it's really different with type="object". I just want to make button that can connect one module to another. It already exists in openerp for a few buttons of type="action". I just want to understand what is the function of "name" of this button?

I have an example, I found this xml script in backend sale folder:

<button name="%(action_view_sale_advance_payment_inv)d"
 string="Create Invoice"
 type="action"
 states="manual"
 class="oe_highlight"
 groups="base.group_user"/>

when I installed sale module, then I see the xml script in frontend sale.order.form, it's already change into:

<button name="278"
 string="Create Invoice"
 type="action"
 states="manual"
 class="oe_highlight"
 groups="base.group_user"/>

What's happening with the "name"? Can anyone give me a simple button of type="action"?


回答1:


There are three kinds of types for button: object, action & workflow. workflow is the default.

Now let's understand the meaning of these three types:

  1. object is used if you want to call a method which is written in .py file.

  2. action is used if you want to call any action which is written in .xml file. Let say if you want to open a wizard from button click then you can use type="action".

  3. workflow (the default) is used if you want to call workflow.


<button name="%(action_view_sale_advance_payment_inv)d"
 string="Create Invoice"
 type="action">

when Create Invoice button is clicked, you will see a wizard.

<button name="278" string="Create Invoice" type="action">

Here 278 is an ID in postgresql database of action_view_sale_advance_payment_inv action.



来源:https://stackoverflow.com/questions/14682253/name-of-type-action-in-openerp-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!