コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3791 ビュー

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

アバター
破棄
著作者

Thank you Ray!

In case I have to give a parameter, do I put it between the parenthesis of ".run()"?

最善の回答
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
アバター
破棄
最善の回答

Thanks for solution Ray, massive help.
To add further use case to this solution, we can specify context to run on specific records (using for loop for example) like this: (I prefer to use action id instead of name, since name can be changed easily)

server_action = env['ir.actions.server'].search([('id','=', your_server_action_id)])
if server_action:
​for record in records:
​server_action.with_context(active_id = record.id, active_model = 'your_model_name').run()




アバター
破棄
関連投稿 返信 ビュー 活動
0
3月 23
1773
0
7月 21
4428
1
1月 21
5117
1
1月 19
5049
1
1月 18
4606