how can i add an option into action dropdown in odoo 10 in "sale order"
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- 项目
- MRP
此问题已终结
4
回复
6629
查看
Hi Sugeesh,
You can do this with an XML record defined as a ir.actions.server and then binding it to an ir.values record. Example in XML:
<record model="ir.actions.server" id="your_custom_action_id">
<field name="name">Your description here</field>
<field name="model_id" ref="your_module.model_your_model_name"/>
<field name="code">
for item in records:
item.your_function()
</field>
</record>
<record model="ir.values" id="ir_value_your_custom">
<field name="model_id" ref="your_module.model_your_model_name"/>
<field name="name">Your title here (shown to user)</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.server,' +str(ref('your_custom_action_id'))"/>
<field name="key">action</field>
<field name="model">your.model.name</field>
</record>
You can then create a Python function to execute code when the user clicks on this action:
@api.multi
def your_function(self):
print('Your custom Python logic comes here')
Regards,
Yenthe
@Yenthe Van Ginneken,
Could you please explain how to set a server action for "MENU ITEMS"
hello , try like below code
<act_window
id="action_account_payment_from_invoices"
name="Register Payment"
res_model="account.register.payments" # which object's view you want to open
src_model="account.invoice" # on which object's view you want to add
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
/>
| 相关帖文 | 回复 | 查看 | 活动 | |
|---|---|---|---|---|
|
|
2
7月 25
|
6492 | ||
|
|
2
10月 25
|
8827 | ||
|
|
2
11月 24
|
29727 | ||
|
|
2
5月 24
|
8412 | ||
|
|
3
3月 24
|
7841 |
Thank you.
You're welcome, hope it helps :)