How to Make Scheduler to Execute an Action on Given Duration?

How to Make Scheduler to Execute an Action on Given Duration?

Subject : Scheduler i.e.cron-job by application(Automated Action).

Related: In Application, Automated Scheduled action will run on given time duration and number of execution between the duration.

Descriptions:

We can make scheduler to execute any action on given duration and number of execution between the date time.

Example: In below example, we are creating on schedule which is of hr.employee.

That means scheduler will execute method of the hr.employee model. And whatever the action defined in that model will execute.

 File: scheduler.xml 

<?xml version=”1.0″?>

<openerp>

<data>

<record id=”ir_cron_employee_email_action” model=”ir.cron” forcecreate=”True”>

<field name=”name”>Employee Birthday Email Scheduler</field>

<field name=”active” eval=”True”/>

<field name=”user_id” ref=”base.user_root” />

<field name=”interval_number”>1</field>

<field name=”interval_type”>days</field>

<field name=”numbercall”>-1</field>

<field name=”model” eval=”‘hr.employee'”/>

<field name=”function” eval=”‘birthday_reminder_schedular'”/>

<field name=”args” eval=”‘()'”/>

</record>

</data>

</openerp>

 

File: hr_employee.py 

class hr_employee(osv.osv):

_name = ‘hr.employee’

##——————————- Birthday Mail Scheduler ——————————————#

def birthday_reminder_schedular(self,cr,uid,context=None):

#action code return true

For Customized Business Solutions at best prices Contact Us now