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')