Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
2561 Tampilan

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
Buang
Penulis Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
0
Mei 23
1352
1
Sep 22
2945
3
Mei 23
6668
0
Nov 22
1987
0
Okt 22
2562