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

Hey

I am trying to implement safe_eval to calculate some formulas but when I try to "import math" it gives me an error  


safe_eval('aoc = math.pi * (radius**2)',{'radius': 3},mode='exec',nocopy= True)
Any suggestions would be greatly appreciated

Thanks


形象
丢弃
编写者 最佳答案

I  blacklisted the import function somewhere in tools.py and now I can import math function

形象
丢弃
最佳答案

Hi,
Can you try importing the library “from odoo.tools.safe_eval import safe_eval” instead of using math library and then use the function safe_eval

形象
丢弃
相关帖文 回复 查看 活动
0
5月 23
1338
1
9月 22
2931
3
5月 23
6620
0
11月 22
1984
0
10月 22
2529