diff --git a/mail_activity_reminder/__manifest__.py b/mail_activity_reminder/__manifest__.py index f686193b3..486db9908 100644 --- a/mail_activity_reminder/__manifest__.py +++ b/mail_activity_reminder/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Mail Activity Reminder", - "version": "13.0.1.0.0", + "version": "16.0.1.0.0", "category": "Discuss", "website": "https://github.com/OCA/social", "author": "CorporateHub, Odoo Community Association (OCA)", diff --git a/mail_activity_reminder/models/mail_activity.py b/mail_activity_reminder/models/mail_activity.py index 329b46e5b..243f91b0f 100644 --- a/mail_activity_reminder/models/mail_activity.py +++ b/mail_activity_reminder/models/mail_activity.py @@ -22,7 +22,6 @@ class MailActivity(models.Model): string="Last reminder (local)", ) deadline = fields.Datetime( - string="Deadline", compute="_compute_deadline", compute_sudo=True, store=True, @@ -99,22 +98,20 @@ class MailActivity(models.Model): ) def action_notify(self): - super().action_notify() + res = super().action_notify() utc_now = fields.Datetime.now().replace(tzinfo=UTC) for activity in self: if activity.last_reminder_local: continue tz = timezone(activity.user_id.sudo().tz or "UTC") activity.last_reminder_local = utc_now.astimezone(tz).replace(tzinfo=None) + return res def action_remind(self): """ Group reminders by user and type and send them together """ MailThread = self.env["mail.thread"] - message_activity_assigned = self.env.ref( - "mail_activity_reminder.message_activity_assigned" - ) utc_now = fields.Datetime.now().replace(tzinfo=UTC) for user in self.mapped("user_id"): activities = self.filtered(lambda activity: activity.user_id == user) @@ -123,9 +120,9 @@ class MailActivity(models.Model): subject = _("Some activities you are assigned too expire soon.") - body = message_activity_assigned.render( + body = self.env["ir.qweb"]._render( + "mail_activity_reminder.message_activity_assigned", dict(activities=activities, model_description="Activities"), - engine="ir.qweb", minimal_qcontext=True, ) MailThread.message_notify( diff --git a/mail_activity_reminder/models/mail_activity_type.py b/mail_activity_reminder/models/mail_activity_type.py index 2199351b2..e9e806d98 100644 --- a/mail_activity_reminder/models/mail_activity_type.py +++ b/mail_activity_reminder/models/mail_activity_type.py @@ -10,7 +10,6 @@ class MailActivityType(models.Model): _inherit = "mail.activity.type" reminders = fields.Char( - string="Reminders", help=( "A non-digit-separated list of offsets (in days) when reminders" ' should be fired: e.g. 0 means "on the deadline day" while' diff --git a/mail_activity_reminder/tests/test_mail_activity_reminder.py b/mail_activity_reminder/tests/test_mail_activity_reminder.py index 3c2235afd..2954de185 100644 --- a/mail_activity_reminder/tests/test_mail_activity_reminder.py +++ b/mail_activity_reminder/tests/test_mail_activity_reminder.py @@ -9,7 +9,7 @@ from freezegun import freeze_time from odoo.tests import common -class TestMailActivityReminder(common.SavepointCase): +class TestMailActivityReminder(common.TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -114,7 +114,7 @@ class TestMailActivityReminder(common.SavepointCase): self.assertEqual(activities, activity) activities.action_remind() - activity.active = False + activity.unlink() with freeze_time(self.now + relativedelta(days=5)): activities = self.MailActivity._get_activities_to_remind() self.assertFalse(activities)