Skip to content
Snippets Groups Projects
Unverified Commit 440c5d6e authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] subscription: avoid trying to access to subscriptions without cron

The cron may no longer be present (e.g. deleted) and the subscribtion would be
blocked in running state.

Fixes #12207
parent fa8abe6a
No related branches found
No related tags found
No related merge requests found
......@@ -130,8 +130,9 @@ class subscription_subscription(osv.osv):
def set_done(self, cr, uid, ids, context=None):
res = self.read(cr,uid, ids, ['cron_id'])
ids2 = [x['cron_id'][0] for x in res if x['id']]
self.pool.get('ir.cron').write(cr, uid, ids2, {'active':False})
ids2 = [x['cron_id'][0] for x in res if x['cron_id']]
if ids2:
self.pool.get('ir.cron').write(cr, uid, ids2, {'active':False})
self.write(cr, uid, ids, {'state':'done'})
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment