want that when there is 2 days left in returning that asset so automatically employee gets alert through email how i can do this
hi i have my module in which i am allocating asset to employee and employee will return that asset in specific time duration, i want that when there is 2 days left in returning that asset so automatically employee gets alert through email how i can do this in open erp v 7
You can use schedulers to send the alert automatically.
First create a scheduler in your module, name the file as
scheduler_data.xml and add the following in it.
<?xml version="1.0" encoding="utf-8"?> <openerp> <data noupdate="1"> <record forcecreate="True" id="ir_cron_check_shipping_date" model="ir.cron"> <field name="name">Asset Reminder</field> <field eval="True" name="active" /> <field eval="False" name="doall" /> <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 eval="your.model.name'" name="model" /> <field eval="'check_asset_date'" name="function" /> <field eval="'(False,)'" name="args" /> </record> </data> </openerp>
In the above, in model field specify the model name (I have given it as your.model.name, replace it with your model name). You can configure the scheduler to execute depending on the intervals available, say days, months, weeks, hours, minutes etc in above code or client side. If you make any changes in client side, it will stay unchanged even if you upgrade the module, because
noupdate="1" is set.
Then define the email template for the email to be send, you can configure the template in client side or in xml code.
Now you need to define the method
check_asset_date in your model.
def check_asset_date(self, cr, uid, ids, context+None): # Your code to check date goest here # Then call the send_mail method of model email.template with desired parameters and you must pass # your email template's id by searching and finding the id of the template. return True
thanks alot but i have confusion that can i make it through interface of open erp v 7 because it has options of emial , server , scheduler . i have watched a video on youtube in which through automated action and scheduler he was sending email. but automated action is not showing in my open erp interface so kindly tell me wheather can i do it through interface or code is the only options
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 1/8/14, 9:29 PM|
|Seen: 1102 times|
|Last updated: 3/16/15, 8:10 AM|