From 6596def03387f0d18f0eaebc4a95849c12514735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 21 Sep 2012 15:20:25 +0200 Subject: [PATCH] Use context manager to correctly set the company review372001 --- cron.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cron.py b/cron.py index 4d91aceb9e..d205087e6a 100644 --- a/cron.py +++ b/cron.py @@ -2,6 +2,7 @@ #this repository contains the full copyright notices and license terms. from trytond.model import ModelView, ModelSQL, fields from trytond.pool import Pool +from trytond.transaction import Transaction class Cron(ModelSQL, ModelView): @@ -20,7 +21,8 @@ class Cron(ModelSQL, ModelView): 'company': company.id, 'main_company': company.id, }) - super(Cron, self)._callback(cron) + with Transaction().set_context(company=company.id): + super(Cron, self)._callback(cron) user_obj.write(cron.user.id, { 'company': None, 'main_company': None,