From ac03946e46d424fb5db960917907f7c318b61c84 Mon Sep 17 00:00:00 2001 From: Olivier LAURENT Date: Mon, 27 Apr 2015 19:14:54 +0200 Subject: [PATCH] [FIX] active_test cannot be propagated to the method to execute --- cron_run_manually/ir_cron.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cron_run_manually/ir_cron.py b/cron_run_manually/ir_cron.py index 7dc7eea6c..91430af7f 100644 --- a/cron_run_manually/ir_cron.py +++ b/cron_run_manually/ir_cron.py @@ -60,9 +60,14 @@ class Cron(models.Model): _logger.info('Job `%s` triggered from form', self.name) + # Do not propagate active_test to the method to execute + ctx = dict(self.env.context) + ctx.pop('active_test', None) + # Execute the cron job - method = getattr(self.sudo(self.user_id).env[self.model], - self.function) + method = getattr( + self.with_context(ctx).sudo(self.user_id).env[self.model], + self.function) args = safe_eval('tuple(%s)' % (self.args or '')) return method(*args)