Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

want that when there is 2 days left in returning that asset so automatically employee gets alert through email how i can do this

By
bakhtawar
on 1/8/14, 9:29 PM 1,105 views

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

1

Gopakumar N G

--Gopakumar N G--
1198
| 5 3 7
Cochin, India
--Gopakumar N G--

Senior Software Engineer at BroadTech IT Solutions Pvt. Ltd.

Gopakumar N G
On 1/9/14, 12:54 AM

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
0
bakhtawar
On 1/10/14, 3:46 AM

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

As far as I know: You can enter the code in the interface. Have you set the technical feature in your user rights?

http://www.youtube.com/watch?v=5dDoPcm6pVM

guido
on 1/10/14, 4:08 AM

yes i have enable technical feature but automated action is not showing in the options

bakhtawar
on 1/12/14, 3:48 PM
0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 1/9/14, 1:35 AM

Hello Bakhtawar,

You just need to write a method to check your condition of date.

In that method you need to create one email template regarding your mail body.

Call that method in scheduler.

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/8/14, 9:29 PM
Seen: 1105 times
Last updated: 3/16/15, 8:10 AM