How to Configure Scheduled
Actions in odoo 18
Enterprise
Enterprise
Scheduled actions in Odoo 18 automate tasks by running specific
operations at set intervals. These background processes help
streamline workflows, such as updating data, sending reminders, or
performing routine tasks, ensuring smooth and efficient system
operations.
Introduction
Enterprise
Scheduled actions, also known as cron jobs, automate routine tasks in
Odoo 18. These tasks run at set intervals without requiring manual
input. By inserting a record into the ir.cron model, Odoo schedules and
executes the task in the background.
This helps businesses streamline repetitive processes like data
updates or reminders. Cron jobs improve efficiency by handling time-
based tasks automatically.
Scheduled Actions
Enterprise
View all scheduled actions under General Settings >
Technical > Scheduled Actions.
Enterprise
The menu displays all scheduled actions with details like
Action Name, Model, Priority, and Status.
Enterprise
Click the 'New' button to open a form where we can add details like Name,
Technical Settings, Action Details, and Code to run the scheduled action.
Enterprise
Also configure Scheduled Actions through code by creating an XML file
named ir_cron_data.xml in the module's data directory. The scheduled
action is defined using XML code.
Explanation
Enterprise
Code
<record id="daily_task_arrange" model="ir.cron">
<field name="name">Daily Tasks</field>
<field name="model_id" ref="model_res_partner"/>
<field name="state">code</field>
<field name="code">model.send_mail()</field>
<field name="user_id" ref="base.user_root"/>
<field name='interval_number'>1</field>
<field name='interval_type'>days</field>
<field name="nextcall"
eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d
12:00:00')"/><field name="priority">1</field></record>
Enterprise
● Record ID: Creates a scheduled action with ID daily_task_arrange.
● Action Name: Set to "Daily Tasks."
● Model: Linked to the res.partner model.
● Execution State: Runs code as specified by <field
name="state">code</field>.
● Code: Executes model.send_mail().
● User: Assigned to the root user.
● Interval: Runs every 1 day.
● Indefinite Calls: Allows unlimited executions.
● Priority: Set to 1.
Explanation
Enterprise
Once all attributes are set, define the send_mail method in the res.partner
model, which will send a test email in this code.
Code
def send_mail(self):
mail_template = self.env.ref('mail.mail_template_test')
.with_context(lang=self.env.user.lang)
mail_template.send_mail(self.id, force_send=True)
Enterprise
After upgrading the module, the scheduled action will be visible in the scheduled
settings menu.
Enterprise
In Odoo 18, scheduled actions automate tasks like report
generation, email sending, and updates, streamlining workflows and
ensuring consistency. This feature reduces manual effort, boosts
efficiency, and lets businesses focus on strategic tasks.
Conclusion
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

How to Configure Scheduled Actions in odoo 18

  • 1.
    How to ConfigureScheduled Actions in odoo 18 Enterprise
  • 2.
    Enterprise Scheduled actions inOdoo 18 automate tasks by running specific operations at set intervals. These background processes help streamline workflows, such as updating data, sending reminders, or performing routine tasks, ensuring smooth and efficient system operations. Introduction
  • 3.
    Enterprise Scheduled actions, alsoknown as cron jobs, automate routine tasks in Odoo 18. These tasks run at set intervals without requiring manual input. By inserting a record into the ir.cron model, Odoo schedules and executes the task in the background. This helps businesses streamline repetitive processes like data updates or reminders. Cron jobs improve efficiency by handling time- based tasks automatically. Scheduled Actions
  • 4.
    Enterprise View all scheduledactions under General Settings > Technical > Scheduled Actions.
  • 5.
    Enterprise The menu displaysall scheduled actions with details like Action Name, Model, Priority, and Status.
  • 6.
    Enterprise Click the 'New'button to open a form where we can add details like Name, Technical Settings, Action Details, and Code to run the scheduled action.
  • 7.
    Enterprise Also configure ScheduledActions through code by creating an XML file named ir_cron_data.xml in the module's data directory. The scheduled action is defined using XML code. Explanation
  • 8.
    Enterprise Code <record id="daily_task_arrange" model="ir.cron"> <fieldname="name">Daily Tasks</field> <field name="model_id" ref="model_res_partner"/> <field name="state">code</field> <field name="code">model.send_mail()</field> <field name="user_id" ref="base.user_root"/> <field name='interval_number'>1</field> <field name='interval_type'>days</field> <field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 12:00:00')"/><field name="priority">1</field></record>
  • 9.
    Enterprise ● Record ID:Creates a scheduled action with ID daily_task_arrange. ● Action Name: Set to "Daily Tasks." ● Model: Linked to the res.partner model. ● Execution State: Runs code as specified by <field name="state">code</field>. ● Code: Executes model.send_mail(). ● User: Assigned to the root user. ● Interval: Runs every 1 day. ● Indefinite Calls: Allows unlimited executions. ● Priority: Set to 1. Explanation
  • 10.
    Enterprise Once all attributesare set, define the send_mail method in the res.partner model, which will send a test email in this code. Code def send_mail(self): mail_template = self.env.ref('mail.mail_template_test') .with_context(lang=self.env.user.lang) mail_template.send_mail(self.id, force_send=True)
  • 11.
    Enterprise After upgrading themodule, the scheduled action will be visible in the scheduled settings menu.
  • 12.
    Enterprise In Odoo 18,scheduled actions automate tasks like report generation, email sending, and updates, streamlining workflows and ensuring consistency. This feature reduces manual effort, boosts efficiency, and lets businesses focus on strategic tasks. Conclusion
  • 13.
    For More Info. Checkour company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com