How to Configure Scheduled Actions in odoo 18

CelineGeorge1 779 views 13 slides May 07, 2025
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

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.


Slide Content

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