Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
534 Weergaven

I am using Odoo V18.

When someone completes a schedule activity, marks it "done", I would like for Odoo to notify the creator of the activity being completed. 

I see that there is a way to create an automation rule with a trigger being the state of activity being set to "done", but I cant figure out the code for the notification.

Avatar
Annuleer
Beste antwoord

I did find another solution aside from Ray's if you would like to try. This solution will send an email to the creator of the activity once an activity is marked as done, however, you will need to recreate this automation for each person that you want to have notified.

This also requires the "Keep Done" field checked for each activity type that you would like the notification, as shown in Ray's solution.

Set the parameters of the automated action as:

Model: Activity

Trigger: On Save

Before update domain rule: Created by = Username

Apply on rule: Done Date -> is set

Add action: Email

For the email template, create a new template and use the following commands in the content window:

For the assigned to user to appear, use the "/field" and navigate to Assigned to>Name

For the Summary to appear, use the "/field" and navigate to Summary

Same for notes if you would like that to appear.

Also, add your email as the send to on the email configuration tab:

Edit - Pictures added


Avatar
Annuleer
Beste antwoord

This is a prototype, not a solution, it may need code adjustments for your specific requirements.


Activate Deloper Mode.

Configure each relevant Activity Type to Keep Done so that the completed Activity record does not get deleted (or you won't be able to trigger the Automation):


Create an Automation Rule like this:

Code like this:

for record in records:
   
    if record.summary:
        summary = f'{record.summary} (Completed)'
    else:
        summary = 'Activity Completed'
   
    env['mail.activity'].create({
        'user_id': record.create_uid.id,
        'res_model': record.res_model,
        'res_model_id': record.res_model_id.id,
        'res_id': record.res_id,
        'summary': summary
    })


Contact your Odoo Digital Advisor or Odoo Partner if you don't have the skills to do this, or need help troubleshooting / adjusting for your specific needs.

Avatar
Annuleer