[FIX]custom report correction acc. to Safe_eval
bzr revid: jvo@tinyerp.com-20100923100145-qvysfefq5ul1ubog
This commit is contained in:
@@ -88,7 +88,7 @@ class report_custom(osv.osv):
|
||||
c_f[i] = []
|
||||
tmp = report.fields_child0[i]
|
||||
for j in range(3):
|
||||
c_f[i].append((not isinstance(eval('tmp.field_child'+str(j)), browse_null) and eval('tmp.field_child'+str(j)+'.ttype')) or None)
|
||||
c_f[i].append((not isinstance(eval('tmp.field_child'+str(j),{},{'tmp':tmp}), browse_null) and eval('tmp.field_child'+str(j)+'.ttype',{},{'tmp':tmp})) or None)
|
||||
if not reduce(lambda x,y : x or y, map(lambda x: x in ['integer', 'float'], c_f[1])):
|
||||
raise osv.except_osv(_('Invalid operation'), _('Second field should be figures'))
|
||||
|
||||
@@ -101,7 +101,7 @@ class report_custom(osv.osv):
|
||||
c_f[i] = []
|
||||
tmp = report.fields_child0[i]
|
||||
for j in range(3):
|
||||
c_f[i].append((not isinstance(eval('tmp.field_child'+str(j)), browse_null) and eval('tmp.field_child'+str(j)+'.ttype')) or None)
|
||||
c_f[i].append((not isinstance(eval('tmp.field_child'+str(j),{},{'tmp':tmp}), browse_null) and eval('tmp.field_child'+str(j)+'.ttype',{},{'tmp':tmp})) or None)
|
||||
|
||||
if i == 0:
|
||||
pass
|
||||
|
||||
@@ -73,7 +73,7 @@ class report_custom(report_int):
|
||||
for cond in conditions:
|
||||
if cond and cond[0]:
|
||||
c = cond[0]
|
||||
temp = c[0](eval('obj.'+c[1]))
|
||||
temp = c[0](eval('obj.'+c[1],{'obj': obj}))
|
||||
if not eval('\''+temp+'\''+' '+c[2]+' '+'\''+str(c[3])+'\''):
|
||||
tobreak = True
|
||||
if tobreak:
|
||||
@@ -87,7 +87,7 @@ class report_custom(report_int):
|
||||
row_canvas[i]=False
|
||||
elif len(fields[i])==1:
|
||||
if not isinstance(obj, browse_null):
|
||||
row.append(str(eval('obj.'+fields[i][0])))
|
||||
row.append(str(eval('obj.'+fields[i][0],{'obj': obj})))
|
||||
else:
|
||||
row.append(None)
|
||||
else:
|
||||
@@ -107,7 +107,7 @@ class report_custom(report_int):
|
||||
else:
|
||||
key = levels.keys()
|
||||
for l in key:
|
||||
objs = eval('obj.'+l)
|
||||
objs = eval('obj.'+l,{'obj': obj})
|
||||
if not isinstance(objs, browse_record_list) and type(objs) <> type([]):
|
||||
objs = [objs]
|
||||
field_new = []
|
||||
@@ -192,7 +192,7 @@ class report_custom(report_int):
|
||||
def build_tree(obj, level, depth):
|
||||
res = self._row_get(cr, uid,[obj], new_fields, new_cond)
|
||||
level.append(depth)
|
||||
new_obj = eval('obj.'+report['field_parent'][1])
|
||||
new_obj = eval('obj.'+report['field_parent'][1],{'obj': obj})
|
||||
if not isinstance(new_obj, list) :
|
||||
new_obj = [new_obj]
|
||||
for o in new_obj:
|
||||
|
||||
Reference in New Issue
Block a user