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

Hi , I'm trying to send a request to the server via an automated action in Odoo. i.e , lets suppose a Sales Order is created. I want to send some of its data to the server and process it elsewhere as well.


I created an automated action with the "Execute Python Code" option. When i try importing the requests library i get the error:

"forbidden opcode(s) in 'import requests\n\nprint("test")': IMPORT_NAME"

Is it possible to import libraries via Odoo automated actions ? If not what are alternatives or workarounds that can be made ?

Thanks in advance

Avatar
Zrušit
Nejlepší odpověď

You cannot directly import in an automated action. You will need to customize the python code of the model on which the automated action is based, add a function to it and call the function from the automated action.

Avatar
Zrušit
Nejlepší odpověď

Hello Ahamd
You can refer following question which will help you to solve your problem.
https://www.odoo.com/forum/help-1/how-to-use-import-module-in-automated-action-in-odoo-sh-11-0-136386

Thanks.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
pro 19
6350
2
čvc 23
2198
1
srp 25
543
1
srp 25
734
2
čvc 25
3297