跳至内容
菜单
此问题已终结
2 回复
7275 查看

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

形象
丢弃
最佳答案

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.

形象
丢弃
最佳答案

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.

形象
丢弃
相关帖文 回复 查看 活动
3
12月 19
6341
2
7月 23
2178
1
8月 25
517
1
8月 25
712
2
7月 25
3259