Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3837 Visualizzazioni

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

Avatar
Abbandona
Autore

Thank you Ray!

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

Risposta migliore
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
Avatar
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 23
1803
0
lug 21
4447
1
gen 21
5169
1
gen 19
5068
1
gen 18
4624