From 385491f46e990936b039c8749b18b8f8a9bcbc86 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Mon, 25 Mar 2013 15:48:33 +0100 Subject: [PATCH] [IMP] yaml_import: add openerp in the evaluation context. bzr revid: vmt@openerp.com-20130325144833-aos5t6x5bc8vi0ss --- openerp/tools/yaml_import.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openerp/tools/yaml_import.py b/openerp/tools/yaml_import.py index 3172caac1f4..2ce7fc0a99a 100644 --- a/openerp/tools/yaml_import.py +++ b/openerp/tools/yaml_import.py @@ -540,10 +540,18 @@ class YamlInterpreter(object): self.noupdate = node.noupdate def process_python(self, node): + import openerp python, statements = node.items()[0] model = self.get_model(python.model) statements = statements.replace("\r\n", "\n") - code_context = { 'model': model, 'cr': self.cr, 'uid': self.uid, 'log': self._log, 'context': self.context } + code_context = { + 'model': model, + 'cr': self.cr, + 'uid': self.uid, + 'log': self._log, + 'context': self.context, + 'openerp': openerp, + } code_context.update({'self': model}) # remove me when no !python block test uses 'self' anymore try: code_obj = compile(statements, self.filename, 'exec')