Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3793 Vistas

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

Avatar
Descartar
Autor

Thank you Ray!

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

Mejor respuesta
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
Avatar
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 23
1774
0
jul 21
4430
1
ene 21
5117
1
ene 19
5050
1
ene 18
4607