2
0

Replace eval by safe_eval

This commit is contained in:
Alex Comba 2014-12-17 14:14:35 +01:00 committed by Abraham Anes
parent 565135f77f
commit 665198b8d7

View File

@ -21,6 +21,7 @@
##############################################################################
from openerp import models, fields, api, exceptions, _
from openerp.tools.safe_eval import safe_eval as eval
from functools import partial
import re
@ -66,7 +67,8 @@ class AccountDocumentTemplate(models.Model):
try:
recurse_lines = partial(self.lines, computed_lines=computed_lines)
computed_lines[line_number] = eval(
line.python_code.replace('L', 'recurse_lines')
line.python_code.replace('L', 'recurse_lines'),
locals_dict={'recurse_lines': recurse_lines}
)
except KeyError:
raise exceptions.Warning(