diff --git a/mail_activity_reminder/README.rst b/mail_activity_reminder/README.rst new file mode 100644 index 00000000..10c7b9fa --- /dev/null +++ b/mail_activity_reminder/README.rst @@ -0,0 +1,91 @@ +====================== +Mail Activity Reminder +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:635275e093f8459aba8510ad763931b5e0ca35e636cb5a287f56f74a5e80f1f2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github + :target: https://github.com/OCA/mail/tree/18.0/mail_activity_reminder + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_activity_reminder + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/mail&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows setting reminders for various Activity Types. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure reminders for specific Activity Type: + +1. Go to *Settings > Technical > Activity Types* +2. Open a specific activity type +3. Fill *Reminders* field with a non-digit-separated list of offsets (in + days) when reminders should be fired: e.g. 0 means "on the deadline + day" while 5 means "5 calendar days before the deadline". + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* CorporateHub + +Contributors +------------ + +- `CorporateHub `__ + + - Alexey Pelykh + +- Denis Roussel + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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/mail `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_activity_reminder/__init__.py b/mail_activity_reminder/__init__.py new file mode 100644 index 00000000..4b76c7b2 --- /dev/null +++ b/mail_activity_reminder/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mail_activity_reminder/__manifest__.py b/mail_activity_reminder/__manifest__.py new file mode 100644 index 00000000..b3d5ac4e --- /dev/null +++ b/mail_activity_reminder/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2020 CorporateHub (https://corporatehub.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Mail Activity Reminder", + "version": "18.0.1.0.0", + "category": "Discuss", + "website": "https://github.com/OCA/mail", + "author": "CorporateHub, Odoo Community Association (OCA)", + "license": "AGPL-3", + "summary": "Reminder notifications about planned activities", + "depends": ["mail"], + "data": [ + "data/mail_activity_reminder_cron.xml", + "views/mail_activity_type.xml", + "data/mail_activity_template.xml", + ], +} diff --git a/mail_activity_reminder/data/mail_activity_reminder_cron.xml b/mail_activity_reminder/data/mail_activity_reminder_cron.xml new file mode 100644 index 00000000..6f994d74 --- /dev/null +++ b/mail_activity_reminder/data/mail_activity_reminder_cron.xml @@ -0,0 +1,16 @@ + + + + + Mail Activity: Reminders + + code + model._process_reminders() + 1 + hours + 2020-01-01 00:01:00 + + diff --git a/mail_activity_reminder/data/mail_activity_template.xml b/mail_activity_reminder/data/mail_activity_template.xml new file mode 100644 index 00000000..8c30b4e2 --- /dev/null +++ b/mail_activity_reminder/data/mail_activity_template.xml @@ -0,0 +1,42 @@ + + + + + diff --git a/mail_activity_reminder/i18n/es.po b/mail_activity_reminder/i18n/es.po new file mode 100644 index 00000000..d0de6ed9 --- /dev/null +++ b/mail_activity_reminder/i18n/es.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_reminder +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-08 13:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid ".
" +msgstr ".
" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "You have some activities assigned that expire soon:" +msgstr "Tienes algunas actividades asignadas que expiran pronto:" + +#. module: mail_activity_reminder +#: model:ir.model.fields,help:mail_activity_reminder.field_mail_activity_type__reminders +msgid "" +"A non-digit-separated list of offsets (in days) when reminders should be " +"fired: e.g. 0 means \"on the deadline day\" while 5 means \"5 calendar days " +"before the deadline\"." +msgstr "" +"Una lista no separada por dígitos de las fechas (en días) en las que deben " +"enviarse los recordatorios: por ejemplo, 0 significa \"el día de la fecha " +"límite\", mientras que 5 significa \"5 días naturales antes de la fecha " +"límite\"." + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity +msgid "Activity" +msgstr "Actividad" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity_type +msgid "Activity Type" +msgstr "Tipo de Actividad" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__deadline +msgid "Deadline" +msgstr "Fecha límite" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__last_reminder_local +msgid "Last reminder (local)" +msgstr "Último recordatorio (local)" + +#. module: mail_activity_reminder +#: model:ir.actions.server,name:mail_activity_reminder.mail_activity_reminder_ir_actions_server +msgid "Mail Activity: Reminders" +msgstr "Actividad de correo: Recordatorios" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__next_reminder +msgid "Next reminder" +msgstr "Siguiente recordatorio" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity_type__reminders +msgid "Reminders" +msgstr "Recordatorios" + +#. module: mail_activity_reminder +#. odoo-python +#: code:addons/mail_activity_reminder/models/mail_activity.py:0 +#, python-format +msgid "Some activities you are assigned too expire soon." +msgstr "Algunas actividades que se te asignan también caducan pronto." + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "View" +msgstr "Vista" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "assigned you an activity" +msgstr "te ha asignado una actividad" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "on" +msgstr "sobre" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "to close for" +msgstr "para cerrar por" diff --git a/mail_activity_reminder/i18n/fr.po b/mail_activity_reminder/i18n/fr.po new file mode 100644 index 00000000..4cdc4446 --- /dev/null +++ b/mail_activity_reminder/i18n/fr.po @@ -0,0 +1,110 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_reminder +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-10-20 09:44+0000\n" +"Last-Translator: Yann Papouin \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid ".
" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "You have some activities assigned that expire soon:" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,help:mail_activity_reminder.field_mail_activity_type__reminders +msgid "" +"A non-digit-separated list of offsets (in days) when reminders should be " +"fired: e.g. 0 means \"on the deadline day\" while 5 means \"5 calendar days " +"before the deadline\"." +msgstr "" +"Une liste de nombres de jours (séparés par tout caractère autre que des " +"chiffres) qui indique quand les rappels doivent être déclenchés : par ex. 0 " +"signifie \"le jour de l'échéance\" tandis que 5 signifie \"5 jours " +"calendaires avant l'échéance\"." + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity +msgid "Activity" +msgstr "Activité" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity_type +msgid "Activity Type" +msgstr "Type d'activité" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__deadline +msgid "Deadline" +msgstr "Echéance" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__last_reminder_local +msgid "Last reminder (local)" +msgstr "Dernier rappel (local)" + +#. module: mail_activity_reminder +#: model:ir.actions.server,name:mail_activity_reminder.mail_activity_reminder_ir_actions_server +msgid "Mail Activity: Reminders" +msgstr "Activité : Rappels" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__next_reminder +msgid "Next reminder" +msgstr "Rappel suivant" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity_type__reminders +msgid "Reminders" +msgstr "Rappels" + +#. module: mail_activity_reminder +#. odoo-python +#: code:addons/mail_activity_reminder/models/mail_activity.py:0 +#, python-format +msgid "Some activities you are assigned too expire soon." +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "View" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "assigned you an activity" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "on" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "to close for" +msgstr "" + +#, python-format +#~ msgid "%s: %s assigned to you, %d day(s) remaining" +#~ msgstr "%s : %s assigné à vous, %d jour(s) restant(s)" diff --git a/mail_activity_reminder/i18n/it.po b/mail_activity_reminder/i18n/it.po new file mode 100644 index 00000000..227a6066 --- /dev/null +++ b/mail_activity_reminder/i18n/it.po @@ -0,0 +1,105 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_reminder +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-30 14:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid ".
" +msgstr ".
" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "You have some activities assigned that expire soon:" +msgstr "Hai delle attività assegnate che scadono a breve:" + +#. module: mail_activity_reminder +#: model:ir.model.fields,help:mail_activity_reminder.field_mail_activity_type__reminders +msgid "" +"A non-digit-separated list of offsets (in days) when reminders should be " +"fired: e.g. 0 means \"on the deadline day\" while 5 means \"5 calendar days " +"before the deadline\"." +msgstr "" +"Un elenco non separato da numeri di offset (in giorni) quando i promemoria " +"devono essere attivati: es. 0 significa \"alla scadenza\" mentre 5 sgnifica " +"\"5 giorni di calendario prima della scadenza\"." + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity +msgid "Activity" +msgstr "Attività" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity_type +msgid "Activity Type" +msgstr "Tipo attività" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__deadline +msgid "Deadline" +msgstr "Scadenza" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_thread +msgid "Email Thread" +msgstr "Discussione e-mail" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__last_reminder_local +msgid "Last reminder (local)" +msgstr "Ultimo promemoria (locale)" + +#. module: mail_activity_reminder +#: model:ir.actions.server,name:mail_activity_reminder.mail_activity_reminder_ir_actions_server +msgid "Mail Activity: Reminders" +msgstr "Attività e-mail: promemoria" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__next_reminder +msgid "Next reminder" +msgstr "Promemoria successivo" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity_type__reminders +msgid "Reminders" +msgstr "Promemoria" + +#. module: mail_activity_reminder +#. odoo-python +#: code:addons/mail_activity_reminder/models/mail_activity.py:0 +#, python-format +msgid "Some activities you are assigned too expire soon." +msgstr "Alcune attività a cui sei assegnato scadono a breve." + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "View" +msgstr "Vista" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "assigned you an activity" +msgstr "ti ha assegnato una attività" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "on" +msgstr "a" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "to close for" +msgstr "da chiudere per" diff --git a/mail_activity_reminder/i18n/mail_activity_reminder.pot b/mail_activity_reminder/i18n/mail_activity_reminder.pot new file mode 100644 index 00000000..bd43fcc7 --- /dev/null +++ b/mail_activity_reminder/i18n/mail_activity_reminder.pot @@ -0,0 +1,99 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_reminder +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid ".
" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "You have some activities assigned that expire soon:" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,help:mail_activity_reminder.field_mail_activity_type__reminders +msgid "" +"A non-digit-separated list of offsets (in days) when reminders should be " +"fired: e.g. 0 means \"on the deadline day\" while 5 means \"5 calendar days " +"before the deadline\"." +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity +msgid "Activity" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity_type +msgid "Activity Type" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__deadline +msgid "Deadline" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__last_reminder_local +msgid "Last reminder (local)" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.actions.server,name:mail_activity_reminder.mail_activity_reminder_ir_actions_server +msgid "Mail Activity: Reminders" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__next_reminder +msgid "Next reminder" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity_type__reminders +msgid "Reminders" +msgstr "" + +#. module: mail_activity_reminder +#. odoo-python +#: code:addons/mail_activity_reminder/models/mail_activity.py:0 +#, python-format +msgid "Some activities you are assigned too expire soon." +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "View" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "assigned you an activity" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "on" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "to close for" +msgstr "" diff --git a/mail_activity_reminder/i18n/pt.po b/mail_activity_reminder/i18n/pt.po new file mode 100644 index 00000000..f6d5cff0 --- /dev/null +++ b/mail_activity_reminder/i18n/pt.po @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_reminder +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-05-11 13:47+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid ".
" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "You have some activities assigned that expire soon:" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,help:mail_activity_reminder.field_mail_activity_type__reminders +msgid "" +"A non-digit-separated list of offsets (in days) when reminders should be " +"fired: e.g. 0 means \"on the deadline day\" while 5 means \"5 calendar days " +"before the deadline\"." +msgstr "" +"Uma lista não separada por dígitos de offsets (em dias) para quando os " +"lembretes devem ser disparados: por exemplo, 0 significa \"no dia do prazo\" " +"e 5 significa \"5 dias de calendário antes do prazo\"." + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity +msgid "Activity" +msgstr "Atividade" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_activity_type +msgid "Activity Type" +msgstr "Tipo de Atividade" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__deadline +msgid "Deadline" +msgstr "Prazo Limite" + +#. module: mail_activity_reminder +#: model:ir.model,name:mail_activity_reminder.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__last_reminder_local +msgid "Last reminder (local)" +msgstr "Último lembrete (local)" + +#. module: mail_activity_reminder +#: model:ir.actions.server,name:mail_activity_reminder.mail_activity_reminder_ir_actions_server +msgid "Mail Activity: Reminders" +msgstr "Atividade de Correio: Lembretes" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity__next_reminder +msgid "Next reminder" +msgstr "Próximo lembrete" + +#. module: mail_activity_reminder +#: model:ir.model.fields,field_description:mail_activity_reminder.field_mail_activity_type__reminders +msgid "Reminders" +msgstr "Lembretes" + +#. module: mail_activity_reminder +#. odoo-python +#: code:addons/mail_activity_reminder/models/mail_activity.py:0 +#, python-format +msgid "Some activities you are assigned too expire soon." +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "View" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "assigned you an activity" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "on" +msgstr "" + +#. module: mail_activity_reminder +#: model_terms:ir.ui.view,arch_db:mail_activity_reminder.message_activity_assigned +msgid "to close for" +msgstr "" + +#, python-format +#~ msgid "%s: %s assigned to you, %d day(s) remaining" +#~ msgstr "%s: %s atribuído a você, %d dia(s) restante(s)" diff --git a/mail_activity_reminder/models/__init__.py b/mail_activity_reminder/models/__init__.py new file mode 100644 index 00000000..e633bfdd --- /dev/null +++ b/mail_activity_reminder/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import mail_activity_type +from . import mail_activity +from . import mail_thread diff --git a/mail_activity_reminder/models/mail_activity.py b/mail_activity_reminder/models/mail_activity.py new file mode 100644 index 00000000..9f00507d --- /dev/null +++ b/mail_activity_reminder/models/mail_activity.py @@ -0,0 +1,137 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from datetime import datetime, time + +from dateutil.relativedelta import relativedelta +from pytz import UTC, timezone + +from odoo import api, fields, models + + +class MailActivity(models.Model): + _inherit = "mail.activity" + + next_reminder = fields.Datetime( + string="Next reminder", + compute="_compute_next_reminder", + compute_sudo=True, + store=True, + ) + last_reminder_local = fields.Datetime( + string="Last reminder (local)", + ) + deadline = fields.Datetime( + compute="_compute_deadline", + compute_sudo=True, + store=True, + ) + + @api.model + def _get_activities_to_remind_domain(self): + """Hook for extensions""" + return [ + ("next_reminder", "<=", fields.Datetime.now()), + ("deadline", ">=", fields.Datetime.now()), + ] + + @api.model + def _get_activities_to_remind(self): + return self.search(self._get_activities_to_remind_domain()) + + @api.model + def _process_reminders(self): + activities = self._get_activities_to_remind() + activities.action_remind() + return activities + + @api.depends( + "user_id.tz", + "activity_type_id.reminders", + "deadline", + "last_reminder_local", + ) + def _compute_next_reminder(self): + now = fields.Datetime.now() + for activity in self: + if activity.deadline < now: + activity.next_reminder = None + continue + reminders = activity.activity_type_id._get_reminder_offsets() + if not reminders: + activity.next_reminder = None + continue + reminders.sort(reverse=True) + tz = timezone(activity.user_id.sudo().tz or "UTC") + last_reminder_local = ( + tz.localize(activity.last_reminder_local) + if activity.last_reminder_local + else None + ) + local_deadline = tz.localize( + datetime.combine( + activity.date_deadline, + time.min, # Schedule reminder based of beginning of day + ) + ) + for reminder in reminders: + next_reminder_local = local_deadline - relativedelta( + days=reminder, + ) + if not last_reminder_local or next_reminder_local > last_reminder_local: + break + if last_reminder_local and next_reminder_local <= last_reminder_local: + activity.next_reminder = None + continue + activity.next_reminder = next_reminder_local.astimezone(UTC).replace( + tzinfo=None + ) + + @api.depends("user_id.tz", "date_deadline") + def _compute_deadline(self): + for activity in self: + tz = timezone(activity.user_id.sudo().tz or "UTC") + activity.deadline = ( + tz.localize(datetime.combine(activity.date_deadline, time.max)) + .astimezone(UTC) + .replace(tzinfo=None) + ) + + def action_notify(self): + 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"] + utc_now = fields.Datetime.now().replace(tzinfo=UTC) + for user in self.mapped("user_id"): + activities = self.filtered( + lambda activity, user=user: activity.user_id == user + ) + tz = timezone(user.sudo().tz or "UTC") + local_now = utc_now.astimezone(tz) + + subject = self.env._("Some activities you are assigned too expire soon.") + + body = self.env["ir.qweb"]._render( + "mail_activity_reminder.message_activity_assigned", + dict(activities=activities, model_description="Activities"), + minimal_qcontext=True, + ) + MailThread.message_notify( + partner_ids=user.partner_id.ids, + body=body, + subject=subject, + model_description="Activity", + notif_layout="mail.mail_notification_light", + ) + activities.update({"last_reminder_local": local_now.replace(tzinfo=None)}) diff --git a/mail_activity_reminder/models/mail_activity_type.py b/mail_activity_reminder/models/mail_activity_type.py new file mode 100644 index 00000000..e9e806d9 --- /dev/null +++ b/mail_activity_reminder/models/mail_activity_type.py @@ -0,0 +1,25 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from re import split + +from odoo import fields, models + + +class MailActivityType(models.Model): + _inherit = "mail.activity.type" + + reminders = fields.Char( + help=( + "A non-digit-separated list of offsets (in days) when reminders" + ' should be fired: e.g. 0 means "on the deadline day" while' + ' 5 means "5 calendar days before the deadline".' + ), + ) + + def _get_reminder_offsets(self): + """Hook for extensions""" + self.ensure_one() + if not self.reminders: + return [] + return [int(x) for x in split(r"\D+", self.reminders) if x] diff --git a/mail_activity_reminder/models/mail_thread.py b/mail_activity_reminder/models/mail_thread.py new file mode 100644 index 00000000..a679da6e --- /dev/null +++ b/mail_activity_reminder/models/mail_thread.py @@ -0,0 +1,12 @@ +from odoo import models + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + def _get_notify_valid_parameters(self): + """Inherit method to add notif_layout in the set of valid parameters""" + + notif_parameters = super()._get_notify_valid_parameters() + # Added notif_layout in the set of valid parameter + return notif_parameters | {"notif_layout"} diff --git a/mail_activity_reminder/pyproject.toml b/mail_activity_reminder/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/mail_activity_reminder/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_activity_reminder/readme/CONFIGURE.md b/mail_activity_reminder/readme/CONFIGURE.md new file mode 100644 index 00000000..b6954c00 --- /dev/null +++ b/mail_activity_reminder/readme/CONFIGURE.md @@ -0,0 +1,7 @@ +To configure reminders for specific Activity Type: + +1. Go to *Settings \> Technical \> Activity Types* +2. Open a specific activity type +3. Fill *Reminders* field with a non-digit-separated list of offsets + (in days) when reminders should be fired: e.g. 0 means "on the + deadline day" while 5 means "5 calendar days before the deadline". diff --git a/mail_activity_reminder/readme/CONTRIBUTORS.md b/mail_activity_reminder/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..a854b218 --- /dev/null +++ b/mail_activity_reminder/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [CorporateHub](https://corporatehub.eu/) + - Alexey Pelykh \<\> +- Denis Roussel \<\> diff --git a/mail_activity_reminder/readme/DESCRIPTION.md b/mail_activity_reminder/readme/DESCRIPTION.md new file mode 100644 index 00000000..7800db6f --- /dev/null +++ b/mail_activity_reminder/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows setting reminders for various Activity Types. diff --git a/mail_activity_reminder/static/description/icon.png b/mail_activity_reminder/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/mail_activity_reminder/static/description/icon.png differ diff --git a/mail_activity_reminder/static/description/index.html b/mail_activity_reminder/static/description/index.html new file mode 100644 index 00000000..0c7bcac4 --- /dev/null +++ b/mail_activity_reminder/static/description/index.html @@ -0,0 +1,439 @@ + + + + + +Mail Activity Reminder + + + +
+

Mail Activity Reminder

+ + +

Beta License: AGPL-3 OCA/mail Translate me on Weblate Try me on Runboat

+

This module allows setting reminders for various Activity Types.

+

Table of contents

+ +
+

Configuration

+

To configure reminders for specific Activity Type:

+
    +
  1. Go to Settings > Technical > Activity Types
  2. +
  3. Open a specific activity type
  4. +
  5. Fill Reminders field with a non-digit-separated list of offsets (in +days) when reminders should be fired: e.g. 0 means “on the deadline +day” while 5 means “5 calendar days before the deadline”.
  6. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • CorporateHub
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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/mail project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_activity_reminder/tests/__init__.py b/mail_activity_reminder/tests/__init__.py new file mode 100644 index 00000000..8f1a3365 --- /dev/null +++ b/mail_activity_reminder/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_mail_activity_reminder diff --git a/mail_activity_reminder/tests/test_mail_activity_reminder.py b/mail_activity_reminder/tests/test_mail_activity_reminder.py new file mode 100644 index 00000000..09b1a31f --- /dev/null +++ b/mail_activity_reminder/tests/test_mail_activity_reminder.py @@ -0,0 +1,199 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from datetime import datetime + +from dateutil.relativedelta import relativedelta +from freezegun import freeze_time + +from odoo.tests import common + + +class TestMailActivityReminder(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + cls.env = cls.env( + context=dict( + cls.env.context, + tracking_disable=True, + no_reset_password=True, + ) + ) + cls.ResUsers = cls.env["res.users"] + cls.Company = cls.env["res.company"] + cls.MailActivityType = cls.env["mail.activity.type"] + cls.MailActivity = cls.env["mail.activity"] + cls.company_id = cls.Company.env.company + cls.now = datetime(2020, 4, 19, 15, 00) + cls.today = cls.now.date() + cls.model_res_partner = cls.env["ir.model"].search( + [("model", "=", "res.partner")], limit=1 + ) + cls.partner_DecoAddict = cls.env["res.partner"].search( + [("name", "ilike", "Deco Addict")], limit=1 + ) + + def test_none_reminders(self): + 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": " -./"} + ) + 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"} + ) + 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"} + ) + user = self.ResUsers.sudo().create( + { + "name": "User", + "login": "user", + "email": "user@example.com", + "company_id": self.company_id.id, + } + ) + activity = self.MailActivity.create( + { + "summary": "Activity", + "activity_type_id": activity_type.id, + "res_model_id": self.model_res_partner.id, + "res_id": self.partner_DecoAddict.id, + "date_deadline": self.today, + "user_id": user.id, + } + ) + + self.assertTrue(activity.last_reminder_local) + + def test_reminder_behaviour(self): + activity_type = self.MailActivityType.create( + {"name": "Activity Type", "reminders": "0/2"} + ) + + with freeze_time(self.now): + activity = self.MailActivity.create( + { + "summary": "Activity", + "activity_type_id": activity_type.id, + "res_model_id": self.model_res_partner.id, + "res_id": self.partner_DecoAddict.id, + "date_deadline": self.today + relativedelta(days=5), + } + ) + + with freeze_time(self.now): + activities = self.MailActivity._get_activities_to_remind() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=2)): + activities = self.MailActivity._get_activities_to_remind() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=3)): + activities = self.MailActivity._get_activities_to_remind() + self.assertEqual(activities, activity) + activities.action_remind() + + with freeze_time(self.now + relativedelta(days=4)): + activities = self.MailActivity._get_activities_to_remind() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=5)): + activities = self.MailActivity._get_activities_to_remind() + self.assertEqual(activities, activity) + activities.action_remind() + + activity.unlink() + with freeze_time(self.now + relativedelta(days=5)): + activities = self.MailActivity._get_activities_to_remind() + self.assertFalse(activities) + + def test_reminder_flow(self): + activity_type = self.MailActivityType.create( + {"name": "Activity Type", "reminders": "0/2"} + ) + + with freeze_time(self.now): + activity = self.MailActivity.create( + { + "summary": "Activity", + "activity_type_id": activity_type.id, + "res_model_id": self.model_res_partner.id, + "res_id": self.partner_DecoAddict.id, + "date_deadline": self.today + relativedelta(days=5), + } + ) + + with freeze_time(self.now): + activities = self.MailActivity._process_reminders() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=2)): + activities = self.MailActivity._process_reminders() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=3)): + activities = self.MailActivity._process_reminders() + self.assertEqual(activities, activity) + + with freeze_time(self.now + relativedelta(days=4)): + activities = self.MailActivity._process_reminders() + self.assertFalse(activities) + + with freeze_time(self.now + relativedelta(days=5)): + activities = self.MailActivity._process_reminders() + self.assertEqual(activities, activity) + + def test_repeated_reminder(self): + activity_type = self.MailActivityType.create( + {"name": "Activity Type", "reminders": "0"} + ) + + with freeze_time(self.now): + activity = self.MailActivity.create( + { + "summary": "Activity", + "activity_type_id": activity_type.id, + "res_model_id": self.model_res_partner.id, + "res_id": self.partner_DecoAddict.id, + "date_deadline": self.today + relativedelta(days=1), + } + ) + + with freeze_time(self.now + relativedelta(days=1)): + activities = self.MailActivity._process_reminders() + self.assertEqual(activities, activity) + + activities = self.MailActivity._process_reminders() + self.assertFalse(activities) + + def test_overdue_reminder(self): + activity_type = self.MailActivityType.create( + {"name": "Activity Type", "reminders": "0"} + ) + + with freeze_time(self.now): + self.MailActivity.create( + { + "summary": "Activity", + "activity_type_id": activity_type.id, + "res_model_id": self.model_res_partner.id, + "res_id": self.partner_DecoAddict.id, + "date_deadline": self.today + relativedelta(days=1), + } + ) + + with freeze_time(self.now + relativedelta(days=2)): + activities = self.MailActivity._get_activities_to_remind() + self.assertFalse(activities) diff --git a/mail_activity_reminder/views/mail_activity_type.xml b/mail_activity_reminder/views/mail_activity_type.xml new file mode 100644 index 00000000..aa43b6f1 --- /dev/null +++ b/mail_activity_reminder/views/mail_activity_type.xml @@ -0,0 +1,22 @@ + + + + + mail_activity_reminder.mail.activity.type.view.form.inherit + mail.activity.type + + + + + + + +