Fix permissions issue.

pull/81/head
Jairo Llopis 2014-09-16 12:55:22 +02:00
parent 872da121f6
commit 42828e9382
1 changed files with 4 additions and 13 deletions

View File

@ -61,17 +61,8 @@ class Cron(models.Model):
_logger.info('Job `%s` triggered from form', self.name) _logger.info('Job `%s` triggered from form', self.name)
# Prepare execution
method = getattr(self.env[self.model], self.function)
args = safe_eval('tuple(%s)' % (self.args or ''))
# Hack the UID
old_uid = self.env.uid
self.env.uid = self.user_id
# Execute the cron job # Execute the cron job
try: method = getattr(self.sudo(self.user_id).env[self.model],
method(*args) self.function)
finally: args = safe_eval('tuple(%s)' % (self.args or ''))
# Revert UID to original method(*args)
self.env.uid = old_uid