Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2633 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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

Avatar
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mag 23
1447
1
set 22
3033
3
mag 23
6796
0
nov 22
2063
0
ott 22
2627