Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
2709 Ansichten

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
Verwerfen
Autor Beste Antwort

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

Avatar
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Mai 23
1512
1
Sept. 22
3080
3
Mai 23
6924
0
Nov. 22
2112
0
Okt. 22
2686