Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
2657 Weergaven

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
Annuleer
Auteur Beste antwoord

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

Avatar
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mei 23
1460
1
sep. 22
3044
3
mei 23
6812
0
nov. 22
2077
0
okt. 22
2637