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

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


Avatar
Descartar
Autor Mejor respuesta

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

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
may 23
1455
1
sept 22
3037
3
may 23
6802
0
nov 22
2070
0
oct 22
2628