İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
2645 Görünümler

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
Vazgeç
Üretici En İyi Yanıt

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

Avatar
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
May 23
1456
1
Eyl 22
3038
3
May 23
6804
0
Kas 22
2072
0
Eki 22
2632