Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3873 Zobrazení

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

Avatar
Zrušit
Autor

Thank you Ray!

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

Nejlepší odpověď
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 23
1852
0
čvc 21
4494
1
led 21
5207
1
led 19
5092
1
led 18
4662