SlideShare a Scribd company logo
1 of 10
www.cybrosys.com
Automated Action In Odoo
INTRODUCTION
 Automated actions can be used to automatically trigger actions based on time conditions. We can use them
to automatically perform some operation on records that meet certain criteria and reach a predefined time.
Schedulers are automated actions that run automatically over a period of time and can do a lot of things.
They execute actions without manual interaction and makes the background jobs very easy. To set up a
schedule you just have to insert a record to 'ir.cron' table and Odoo will execute it as you define it.
1. Creating the model and fields
 The first step is to create a model (if you don’t have one yet) and to create some fields on this
model:
class ModelName(models.Model):
_name = 'model.name'
fields_name = fields.Char(string=" ")
def method_name(self):
"Your code here"
2. Creating the views
 Once you have created the database, now it is time to create the view
3. Creating the automated action
<?xml version="1.0" ?>
<odoo>
<data noupdate="1">
<record id="backup_scheduler" model="ir.cron">
<field name="function">schedule_backup</field>
<field name="interval_type">work_days</field>
<field name="name">Backup scheduler</field>
<field name="numbercall">-1</field>
<field name="priority">5</field>
<field name="doall">False</field>
<field name="active">False</field>
<field name="interval_number">1</field>
<field name="model">db.backup</field>
</record>
</data>
</odoo>
 An important thing to note with automated actions is that they always should be defined within a 'noupdate'
field. Because this part shouldn’t be updated when you update your module.
 Here in above example
<data noupdate="1">
 Indicate that all code within this tag shouldn’t be updated when you update your module.
<record id="unique_name" model="ir.cron">
 The id is a unique identifier for Odoo to know what record is linked to which id. The model “ir.cron” is the
model specifically made by Odoo for all automated actions. This model contains all automated actions and
always it should be specified.
<field name="name">Name </field>
 Indicate the name of the fields.
<field name="active" eval="True" />
 Boolean value indicating whether the ‘cron’ job is active or not.
<field name="user_id" ref="base.user_root"/>
 This user id is referring to a specific user, in most cases this will be ‘base.user_root’.
<field name="interval_number">1</field>
 Number of times the scheduler is to be called based on the “interval_type”
<field name="interval_type">days</field>
 Interval Unit.
It should be one value for the list: minutes, hours, days, weeks, months.
<field name="numbercall">-1</field>
 An integer value specifying how many times the job is executed. A negative value means no limit.
<field name="doall">1</field>
 A Boolean value indicating whether missed occurrences should be executed when the server restart
<field name="nextcall" >2016-12-31 23:59:59</field> <!-- notice the date/time format -->
 Next planned execution date for this job.
<field name="model" eval="'model.name '" />
 This field specifies on which model the automated action should be called.
<field name="function" eval="'method_name '" />
 Name of the method to be called when this job is processed.
<field name="args" eval="" />
 The arguments to be passed to the method.
<field name="priority" eval="5" />
 The priority of the job, as an integer: 0 means higher priority, 10 means lower priority.
Refer this link for more:
https://www.cybrosys.com/blog/automated-action-in-odoo
Thank You !
Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park,
Kakkancherry,
Calicut University P.O.
Calicut
Kerala, India - 673635.
Cybrosys Ltd
15, ST Antonys Road,
Forest Gate, London
England,
E79QA.
Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, Kerala,
India-682030.

More Related Content

More from Celine George

More from Celine George (20)

Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales AppHow to Make Down Payments in Odoo 17 Sales App
How to Make Down Payments in Odoo 17 Sales App
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

Recently uploaded

zidauu _business communication.pptx /pdf
zidauu _business  communication.pptx /pdfzidauu _business  communication.pptx /pdf
zidauu _business communication.pptx /pdf
zukhrafshabbir
 
What is paper chromatography, principal, procedure,types, diagram, advantages...
What is paper chromatography, principal, procedure,types, diagram, advantages...What is paper chromatography, principal, procedure,types, diagram, advantages...
What is paper chromatography, principal, procedure,types, diagram, advantages...
srcw2322l101
 
Constitution of Company Article of Association
Constitution of Company Article of AssociationConstitution of Company Article of Association
Constitution of Company Article of Association
seri bangash
 

Recently uploaded (20)

How to Maintain Healthy Life style.pptx
How to Maintain  Healthy Life style.pptxHow to Maintain  Healthy Life style.pptx
How to Maintain Healthy Life style.pptx
 
The Inspiring Personality To Watch In 2024.pdf
The Inspiring Personality To Watch In 2024.pdfThe Inspiring Personality To Watch In 2024.pdf
The Inspiring Personality To Watch In 2024.pdf
 
How to refresh to be fit for the future world
How to refresh to be fit for the future worldHow to refresh to be fit for the future world
How to refresh to be fit for the future world
 
Powers and Functions of CPCB - The Water Act 1974.pdf
Powers and Functions of CPCB - The Water Act 1974.pdfPowers and Functions of CPCB - The Water Act 1974.pdf
Powers and Functions of CPCB - The Water Act 1974.pdf
 
Inside the Black Box of Venture Capital (VC)
Inside the Black Box of Venture Capital (VC)Inside the Black Box of Venture Capital (VC)
Inside the Black Box of Venture Capital (VC)
 
Pitch Deck Teardown: Terra One's $7.5m Seed deck
Pitch Deck Teardown: Terra One's $7.5m Seed deckPitch Deck Teardown: Terra One's $7.5m Seed deck
Pitch Deck Teardown: Terra One's $7.5m Seed deck
 
Innomantra Viewpoint - Building Moonshots : May-Jun 2024.pdf
Innomantra Viewpoint - Building Moonshots : May-Jun 2024.pdfInnomantra Viewpoint - Building Moonshots : May-Jun 2024.pdf
Innomantra Viewpoint - Building Moonshots : May-Jun 2024.pdf
 
Potato Flakes Manufacturing Plant Project Report.pdf
Potato Flakes Manufacturing Plant Project Report.pdfPotato Flakes Manufacturing Plant Project Report.pdf
Potato Flakes Manufacturing Plant Project Report.pdf
 
Creative Ideas for Interactive Team Presentations
Creative Ideas for Interactive Team PresentationsCreative Ideas for Interactive Team Presentations
Creative Ideas for Interactive Team Presentations
 
Series A Fundraising Guide (Investing Individuals Improving Our World) by Accion
Series A Fundraising Guide (Investing Individuals Improving Our World) by AccionSeries A Fundraising Guide (Investing Individuals Improving Our World) by Accion
Series A Fundraising Guide (Investing Individuals Improving Our World) by Accion
 
zidauu _business communication.pptx /pdf
zidauu _business  communication.pptx /pdfzidauu _business  communication.pptx /pdf
zidauu _business communication.pptx /pdf
 
How Do Venture Capitalists Make Decisions?
How Do Venture Capitalists Make Decisions?How Do Venture Capitalists Make Decisions?
How Do Venture Capitalists Make Decisions?
 
Meaningful Technology for Humans: How Strategy Helps to Deliver Real Value fo...
Meaningful Technology for Humans: How Strategy Helps to Deliver Real Value fo...Meaningful Technology for Humans: How Strategy Helps to Deliver Real Value fo...
Meaningful Technology for Humans: How Strategy Helps to Deliver Real Value fo...
 
LinkedIn Masterclass Techweek 2024 v4.1.pptx
LinkedIn Masterclass Techweek 2024 v4.1.pptxLinkedIn Masterclass Techweek 2024 v4.1.pptx
LinkedIn Masterclass Techweek 2024 v4.1.pptx
 
8 Questions B2B Commercial Teams Can Ask To Help Product Discovery
8 Questions B2B Commercial Teams Can Ask To Help Product Discovery8 Questions B2B Commercial Teams Can Ask To Help Product Discovery
8 Questions B2B Commercial Teams Can Ask To Help Product Discovery
 
What is paper chromatography, principal, procedure,types, diagram, advantages...
What is paper chromatography, principal, procedure,types, diagram, advantages...What is paper chromatography, principal, procedure,types, diagram, advantages...
What is paper chromatography, principal, procedure,types, diagram, advantages...
 
Copyright: What Creators and Users of Art Need to Know
Copyright: What Creators and Users of Art Need to KnowCopyright: What Creators and Users of Art Need to Know
Copyright: What Creators and Users of Art Need to Know
 
Constitution of Company Article of Association
Constitution of Company Article of AssociationConstitution of Company Article of Association
Constitution of Company Article of Association
 
Event Report - IBM Think 2024 - It is all about AI and hybrid
Event Report - IBM Think 2024 - It is all about AI and hybridEvent Report - IBM Think 2024 - It is all about AI and hybrid
Event Report - IBM Think 2024 - It is all about AI and hybrid
 
Hyundai capital 2024 1q Earnings release
Hyundai capital 2024 1q Earnings releaseHyundai capital 2024 1q Earnings release
Hyundai capital 2024 1q Earnings release
 

Automated action in odoo

  • 2. INTRODUCTION  Automated actions can be used to automatically trigger actions based on time conditions. We can use them to automatically perform some operation on records that meet certain criteria and reach a predefined time. Schedulers are automated actions that run automatically over a period of time and can do a lot of things. They execute actions without manual interaction and makes the background jobs very easy. To set up a schedule you just have to insert a record to 'ir.cron' table and Odoo will execute it as you define it.
  • 3. 1. Creating the model and fields  The first step is to create a model (if you don’t have one yet) and to create some fields on this model: class ModelName(models.Model): _name = 'model.name' fields_name = fields.Char(string=" ") def method_name(self): "Your code here"
  • 4. 2. Creating the views  Once you have created the database, now it is time to create the view 3. Creating the automated action <?xml version="1.0" ?> <odoo> <data noupdate="1"> <record id="backup_scheduler" model="ir.cron"> <field name="function">schedule_backup</field> <field name="interval_type">work_days</field> <field name="name">Backup scheduler</field> <field name="numbercall">-1</field> <field name="priority">5</field> <field name="doall">False</field> <field name="active">False</field> <field name="interval_number">1</field> <field name="model">db.backup</field> </record> </data> </odoo>
  • 5.  An important thing to note with automated actions is that they always should be defined within a 'noupdate' field. Because this part shouldn’t be updated when you update your module.  Here in above example <data noupdate="1">  Indicate that all code within this tag shouldn’t be updated when you update your module. <record id="unique_name" model="ir.cron">  The id is a unique identifier for Odoo to know what record is linked to which id. The model “ir.cron” is the model specifically made by Odoo for all automated actions. This model contains all automated actions and always it should be specified.
  • 6. <field name="name">Name </field>  Indicate the name of the fields. <field name="active" eval="True" />  Boolean value indicating whether the ‘cron’ job is active or not. <field name="user_id" ref="base.user_root"/>  This user id is referring to a specific user, in most cases this will be ‘base.user_root’. <field name="interval_number">1</field>
  • 7.  Number of times the scheduler is to be called based on the “interval_type” <field name="interval_type">days</field>  Interval Unit. It should be one value for the list: minutes, hours, days, weeks, months. <field name="numbercall">-1</field>  An integer value specifying how many times the job is executed. A negative value means no limit.
  • 8. <field name="doall">1</field>  A Boolean value indicating whether missed occurrences should be executed when the server restart <field name="nextcall" >2016-12-31 23:59:59</field> <!-- notice the date/time format -->  Next planned execution date for this job. <field name="model" eval="'model.name '" />  This field specifies on which model the automated action should be called. <field name="function" eval="'method_name '" />  Name of the method to be called when this job is processed. <field name="args" eval="" />  The arguments to be passed to the method. <field name="priority" eval="5" />  The priority of the job, as an integer: 0 means higher priority, 10 means lower priority.
  • 9. Refer this link for more: https://www.cybrosys.com/blog/automated-action-in-odoo
  • 10. Thank You ! Cybrosys Technologies Pvt. Ltd. Neospace, Kinfra Techno Park, Kakkancherry, Calicut University P.O. Calicut Kerala, India - 673635. Cybrosys Ltd 15, ST Antonys Road, Forest Gate, London England, E79QA. Cybrosys Technologies Pvt. Ltd. 1st Floor, Thapasya Building, Infopark, Kakkanad, Kochi, Kerala, India-682030.