Odoo Help


Automated action runs forever [v7]

Yassine TEIMI
on 3/18/15, 4:21 AM 1,121 views

 I've set up an automated action related to claims module, so as to send automatically a reminder email, one day before the claim's deadline date. I overwrited the type of date_deadline to datetime. it was date type before. 

Now the my automated action is created with the following parameters : 

Model : crm_clam
Timer : Trigger date = date_deadline - 1 day ; so as to trigger the automated action one day before the deadline datetime.

Action : server action described below 

Server action :

To send the mail I made a server action of type : Python code, where I called the email the template to be sent following a condition.

I tried to make a time condition that triggers the server action only if the deadline date still not passed.   

Here after the server action :

# You can use the following variables:

# - self: ORM model of the record on which the action is triggered

# - object: browse_record of the record on which the action is triggered if there is one, otherwise None

# - pool: ORM model pool (i.e. self.pool)

# - time: Python time module

# - cr: database cursor

# - uid: current user id

# - context: current context

# If you plan to return an action, assign: action = {...}

from datetime import datetime

tmpl_obj = self.pool.get('email.template')

tmpl_ids = tmpl_obj.search(cr, uid, ids, [('name','=','Rappel Reclamation')])

if tmpl_ids and datetime.strptime(object.date_deadline,"%Y-%m-%d").date() >= datetime.now().date():

      tmpl_obj.send_mail(cr,uid, tmpl_ids[0], object.id,True)

It marked that we can use the time module, how can we use it to achieve the condition ?

The email is not triggered, 

Suggestions please ?

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 3/18/15, 4:21 AM
Seen: 1121 times
Last updated: 5/3/15, 2:05 AM