Skip to content

Instantly share code, notes, and snippets.

@3mrdev
Created October 8, 2022 16:37
Show Gist options
  • Save 3mrdev/4f295ae83c0788b9a690358190e07d8a to your computer and use it in GitHub Desktop.
Save 3mrdev/4f295ae83c0788b9a690358190e07d8a to your computer and use it in GitHub Desktop.
How to make a cron job in Odoo? (Recurrent Background Service)
<odoo>
<data noupdate="0">
<record id="cron_id" forcecreate='True' model="ir.cron">
<field name="name">Cron Name</field>
<field eval="True" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">5</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="model_your_model_name"/>
<field name="state">code</field>
<field name="code">model.your_method()</field>
</record>
</data>
</odoo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment