تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2631 أدوات العرض

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


الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مايو 23
1447
1
سبتمبر 22
3033
3
مايو 23
6796
0
نوفمبر 22
2063
0
أكتوبر 22
2627