Skip to Content
Menu
This question has been flagged
1 Odpoveď
1766 Zobrazenia

I am trying to create an automated action, when I craete an activity I want to send an email a month before the deadline, now I am testing it and put 1 day only and it didn't work 



Avatar
Zrušiť
Best Answer

You would be better creating a Scheduled Action, but this will require some python knowledge. You run it every day at 1:00 am for example and it would look something like this:

acts = env['mail.activity'].search([()])

for a in acts:

    check_date = a.deadline_date - datetime.timedelta(months=1)

    if check_date == datetime.datetime.now().date():
          body = """text ""

​  vals = {

​    'subject' : '',

​    'email_from' : '',

​    'email_to' : '',

​    'body_html' : body

​  }

​  env['mail.mail'].sudo().create(vals)





Avatar
Zrušiť
Autor

I have standered Odoo I can't use code

Related Posts Replies Zobrazenia Aktivita
2
jan 24
1982
0
máj 21
1868
1
mar 24
3156
0
aug 24
1426
3
jún 25
2407