Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
3874 Prikazi

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

Avatar
Opusti
Avtor

Thank you Ray!

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

Best Answer
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
Avatar
Opusti
Best Answer

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()




Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
mar. 23
1852
0
jul. 21
4495
1
jan. 21
5207
1
jan. 19
5092
1
jan. 18
4662