I'm trying to create a cron job that saves subcriptions on Odoo database.
The "save_subscription" method works fine when called from a button, but when it is
called from the cron job, I get an empty recordset. I tried logging "self" and
get the following:
When called from cron:
SELF res.company()
When called from button:
SELF res.company(1,)
When executing the cron job, every model I try to access with self.env['model'] is also empty.
I've tried changing the decorator to @api.multi but no luck. I've also tried this answer https://www.odoo.com/pt_BR/forum/help-1/question/how-to-call-a-scheduled-task-cron-using-the-new-api-v8-90924 but I still get an empty recordset.
Can anyone tell me how to access my records through a cron job? I feel like I'm doing a silly mistake but I've tried everything and couldn't find it.
Thanks in advance!
...
self.save_subscription(sub, created_at == today.date())
return
...