I am trying to add a cron job that should run every day at 12 pm. I am facing a few issue and have a few doubts.
1. I was able to run it every minute but couldn't run it at a specific time.
2. How to know which timezone is expected and which timezone is set in the "nextcall" field
3. It doesnt run until I open console in the browser. How can it be done so that it runs at the server and no additional action is needed?
sd_cron_data.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="ir_cron_module_get_active_sr" model="ir.cron">
<field name="name">Get Active Srs</field>
<!--<field name="user_id" ref="base.user_root" />-->
<!-- <field name="interval_number">2</field>
<field name="interval_type">minutes</field>-->
<field name="numbercall">-1</field>
<field name="nextcall" eval="(datetime.utcnow() + timedelta(days=0)).strftime('%Y-%m-%d 12:22:00')" />
<field name="doall" eval="True" />
<field name="model" eval="'sd.cron'" />
<field name="function" eval="'get_active_srs'" />
<field name="args" eval="'(None,)'" />
<field name="priority">1</field>
</record>
</data>
</odoo>sd_cron.py
class sd_cron(models.Model):
_name = 'sd.cron'
_description = "Class for automated actions."
def get_active_srs(self, a):time_now = datetime.datetime.now().time()
_logger.warning("Scheduler called at :" + str(time_now))