Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3498 มุมมอง

Is it a simple task to send a reminder email to the user that an activity (reminder, To Do etc) is due in x number of days?

How can this be done?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You need to create a model and based on that model you can create a schedular action

Create a Scheduled Action, Define a Function to Send Emails, Create an Email Template, Configure Email Sending, Link Scheduled Action with Function:


from odoo import api, fields, models

class Reminder(models.Model):
    _name = 'your.module.reminder'
    _description = 'Activity Reminder'

    name = fields.Char(string='Activity Name', required=True)
    due_date = fields.Date(string='Due Date', required=True)
    user_id = fields.Many2one('res.users', string='User', required=True)

    @api.model
    def send_reminder_emails(self):
        # Triggered by scheduled action
        upcoming_activities = self.search([('due_date', '=', fields.Date.today() + timedelta(days=7))])

        for activity in upcoming_activities:
            template = self.env.ref('your.module_email_template')
            template.send_mail(activity.id, force_send=True)

class ReminderEmailTemplate(models.Model):
    _name = 'your.module.email.template'
    _description = 'Reminder Email Template'

    name = fields.Char(string='Template Name', required=True)
    subject = fields.Char(string='Email Subject', required=True)
    body_html = fields.Html(string='Email Body', required=True)


Hope it helps

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi 

You can Create Automated actions for Mail activity based on the due days.

Automated Actions

Automated actions using Studio


Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 23
2098
Value set to false by default? แก้ไขแล้ว
2
เม.ย. 23
3154
2
ก.พ. 24
4844
1
เม.ย. 24
2332
0
มี.ค. 24
4431