In this slide, we’ll discuss the scheduled actions in odoo 17. Scheduled Actions in Odoo empower users to automate specific operations on a scheduled basis, ensuring that recurring tasks are executed without manual intervention.
Size: 561.65 KB
Language: en
Added: Aug 09, 2024
Slides: 10 pages
Slide Content
Scheduled actions in odoo 17 Enterprise
Introduction Enterpr ise In this slide, we’ll discuss the scheduled actions in odoo 17. Scheduled Actions in Odoo empower users to automate specific operations on a scheduled basis, ensuring that recurring tasks are executed without manual intervention.
Enterprise We can go to scheduled actions from settings -> Technical -> Automation -> Scheduled actions.
Enterprise For creating a scheduled action, we can add the scheduled action record in the ir_cron_data.xml file in the data directory of in the custom module. And add the file inside the manifest file.
Enterprise This is the sample code for adding a scheduled action.
Enterprise The breakdown of each line of the code: - noupdate="1": attribute of the data tag indicates that existing records with the same ID should not be updated, the automated actions are always specified in the no update field. - id and model of record tag: The unique ID of a record that will be saved on the given model. In this case, it will be kept in the ir.cron model. - name: Specifies the name of the cron job as "Test Action To Do." This name is typically used for display purposes.
Enterprise - model_id: Associates the cron job with a specific model by referencing the model's ID. In this case, it's linked to the "res.partner" model. - state: Indicates that the cron job is implemented using Python code. The state is set to "code," meaning the cron job will execute a Python method. - code: Contains the Python code associated with the cron job. Here, it calls the "action_cron_test_method()" method on the "model" object. - user_id: Specifies the user ID associated with the cron job. In most cases, it's set to the root user.
Enterprise - interval_number: It indicates that the cron job should run every 1 unit of the specified interval type. - interval_type: Specifies the interval type. Here, it is set as "days." That means the cron job is configured to run every day. - numbercall: This parameter sets the maximum number of times the automated action should run. -1, indicating that the cron job should run indefinitely.
Enterprise After successfully adding the scheduled action and upgrading the module, we can see the scheduled action from the Technical menu in Settings.
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