[FIX] subscription: use an @api.model method for cron
Since the cron engine has been migrated to use the new-api (4ddc323139),
cron methods should be defined as `@api.model`
This commit is contained in:
@@ -74,13 +74,17 @@ class Subscription(models.Model):
|
||||
'nextcall': subscription.date_init,
|
||||
'model': self._name,
|
||||
'args': repr([[subscription.id]]),
|
||||
'function': 'model_copy',
|
||||
'function': '_cron_model_copy',
|
||||
'priority': 6,
|
||||
'user_id': subscription.user_id.id
|
||||
}
|
||||
cron = self.env['ir.cron'].create(cron_data)
|
||||
subscription.write({'cron_id': cron.id, 'state': 'running'})
|
||||
|
||||
@api.model
|
||||
def _cron_model_copy(self, ids):
|
||||
self.browse(ids).model_copy()
|
||||
|
||||
@api.multi
|
||||
def model_copy(self):
|
||||
for subscription in self.filtered(lambda sub: sub.cron_id):
|
||||
|
||||
Reference in New Issue
Block a user