[MIG][13.0] mail_activity_reminder

pull/1134/head
Denis Roussel 2023-04-21 19:05:39 +02:00
parent f773c0b668
commit 91c2b63c0f
7 changed files with 27 additions and 29 deletions

View File

@ -14,13 +14,13 @@ Mail Activity Reminder
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/12.0/mail_activity_reminder
:target: https://github.com/OCA/social/tree/13.0/mail_activity_reminder
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_activity_reminder
:target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_activity_reminder
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/12.0
:target: https://runbot.odoo-community.org/runbot/205/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -55,7 +55,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reminder%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reminder%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -74,6 +74,8 @@ Contributors
* Alexey Pelykh <alexey.pelykh@corphub.eu>
* Denis Roussel <denis.roussel@acsone.eu>
Maintainers
~~~~~~~~~~~
@ -87,6 +89,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mail_activity_reminder>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/13.0/mail_activity_reminder>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -4,14 +4,12 @@
{
"name": "Mail Activity Reminder",
"version": "12.0.1.0.1",
"version": "13.0.1.0.0",
"category": "Discuss",
"website": "https://github.com/OCA/social",
"author": "CorporateHub, " "Odoo Community Association (OCA)",
"author": "CorporateHub, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"application": False,
"summary": "Reminder notifications about planned activities",
"depends": ["mail",],
"data": ["data/mail_activity_reminder_cron.xml", "views/mail_activity_type.xml",],
"depends": ["mail"],
"data": ["data/mail_activity_reminder_cron.xml", "views/mail_activity_type.xml"],
}

View File

@ -41,7 +41,6 @@ class MailActivity(models.Model):
activities.action_remind()
return activities
@api.multi
@api.depends(
"user_id.tz", "activity_type_id.reminders", "deadline", "last_reminder_local",
)
@ -79,7 +78,6 @@ class MailActivity(models.Model):
tzinfo=None
)
@api.multi
@api.depends("user_id.tz", "date_deadline")
def _compute_deadline(self):
for activity in self:
@ -90,7 +88,6 @@ class MailActivity(models.Model):
.replace(tzinfo=None)
)
@api.multi
def action_notify(self):
super().action_notify()
utc_now = fields.Datetime.now().replace(tzinfo=UTC)
@ -100,7 +97,6 @@ class MailActivity(models.Model):
tz = timezone(activity.user_id.sudo().tz or "UTC")
activity.last_reminder_local = utc_now.astimezone(tz).replace(tzinfo=None)
@api.multi
def action_remind(self):
IrModel = self.env["ir.model"]
MailThread = self.env["mail.thread"]

View File

@ -3,7 +3,7 @@
from re import split
from odoo import api, fields, models
from odoo import fields, models
class MailActivityType(models.Model):
@ -18,7 +18,6 @@ class MailActivityType(models.Model):
),
)
@api.multi
def _get_reminder_offsets(self):
"""Hook for extensions"""
self.ensure_one()

View File

@ -1,3 +1,5 @@
* `CorporateHub <https://corporatehub.eu/>`__
* Alexey Pelykh <alexey.pelykh@corphub.eu>
* Denis Roussel <denis.roussel@acsone.eu>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Mail Activity Reminder</title>
<style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_activity_reminder"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_activity_reminder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/13.0/mail_activity_reminder"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_activity_reminder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows setting reminders for various Activity Types.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@ -408,7 +408,7 @@ in one message.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reminder%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_reminder%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -426,6 +426,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Alexey Pelykh &lt;<a class="reference external" href="mailto:alexey.pelykh&#64;corphub.eu">alexey.pelykh&#64;corphub.eu</a>&gt;</li>
</ul>
</li>
<li>Denis Roussel &lt;<a class="reference external" href="mailto:denis.roussel&#64;acsone.eu">denis.roussel&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
@ -435,7 +436,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mail_activity_reminder">OCA/social</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/13.0/mail_activity_reminder">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -34,24 +34,24 @@ class TestMailActivityReminder(common.SavepointCase):
)
def test_none_reminders(self):
activity_type = self.MailActivityType.create({"name": "Activity Type",})
activity_type = self.MailActivityType.create({"name": "Activity Type"})
self.assertEqual(activity_type._get_reminder_offsets(), [])
def test_empty_reminders(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": " -./",}
{"name": "Activity Type", "reminders": " -./"}
)
self.assertEqual(activity_type._get_reminder_offsets(), [])
def test_delimiters(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0 1_2/3.4t5",}
{"name": "Activity Type", "reminders": "0 1_2/3.4t5"}
)
self.assertEqual(activity_type._get_reminder_offsets(), [0, 1, 2, 3, 4, 5])
def test_first_notice_is_reminder(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0",}
{"name": "Activity Type", "reminders": "0"}
)
user = self.ResUsers.sudo().create(
{
@ -76,7 +76,7 @@ class TestMailActivityReminder(common.SavepointCase):
def test_reminder_behaviour(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0/2",}
{"name": "Activity Type", "reminders": "0/2"}
)
with freeze_time(self.now):
@ -119,7 +119,7 @@ class TestMailActivityReminder(common.SavepointCase):
def test_reminder_flow(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0/2",}
{"name": "Activity Type", "reminders": "0/2"}
)
with freeze_time(self.now):
@ -155,7 +155,7 @@ class TestMailActivityReminder(common.SavepointCase):
def test_repeated_reminder(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0",}
{"name": "Activity Type", "reminders": "0"}
)
with freeze_time(self.now):
@ -178,7 +178,7 @@ class TestMailActivityReminder(common.SavepointCase):
def test_overdue_reminder(self):
activity_type = self.MailActivityType.create(
{"name": "Activity Type", "reminders": "0",}
{"name": "Activity Type", "reminders": "0"}
)
with freeze_time(self.now):