Hey folks,
I'm running Odoo 10 in a Docker for development locally, and I'm trying to run an action once daily. This action is for syncing access tokens for an external API. If I run this action manually from a button I added myself, it works, but running it as an ir.cron action, nothing happens. This is my action and the function it calls:
<record id="refresh_tokens" model="ir.cron"> <field name="name">Vernieuw access tokens</field> <field name="user_id" ref="base.user_root" /> <field name="interval_number">1</field> <field name="interval_type">days</field> <field name="numbercall">5</field> <field eval="True" name="doall" /> <field eval="'res.users'" name="model" /> <field eval="'refresh_tokens'" name="function" /> </record> |
@api.multi def refresh_tokens(self): config = self.env['app.api_config'].search([('active', '=', True)]) client = config.get_client() api = api_class(client, config.authority, config.redirect_url, config.scopes) for record in self: _logger.warning(record.refresh_token) tokens = api.refresh_access_tokens(record.refresh_token) _logger.warning(tokens) record.save_tokens(tokens.get('access_token'), tokens.get('refresh_token')) |
If I set the schedule to run immediately, it does seem to change the schedule to tomorrow and the number of calls decreases by one, but I don't see any logs or calls to the external API in my shell, and the fields on my model are not updated.
Does anyone know what I can do to troubleshoot this? It's in a docker container which runs on UTC, and I've set my PC to UTC as well without any luck.
Many thanks in advance,
Robrecht