diff --git a/hr_holidays_summary_email/README.rst b/hr_holidays_summary_email/README.rst new file mode 100644 index 00000000..1c431409 --- /dev/null +++ b/hr_holidays_summary_email/README.rst @@ -0,0 +1,103 @@ +====================== +Holidays Summary Email +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b07b8a34ea45e8afe8f4f1b4dbd8b5cca645ec333ddffb8a2fbb3b17285a5f53 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fhr--holidays-lightgray.png?logo=github + :target: https://github.com/OCA/hr-holidays/tree/17.0/hr_holidays_summary_email + :alt: OCA/hr-holidays +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/hr-holidays-17-0/hr-holidays-17-0-hr_holidays_summary_email + :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/hr-holidays&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows sending a daily/weekly email to employees with a +summary of the leaves on that period of other employees in the same +company. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +For each employee, three options can be selected for the Leave Summary +Email configuration: + +- No: No email with the leaves summary is sent to the employee. +- Daily: A daily email with the leaves summary is sent to the employee. +- Weekly: A weekly email with the leaves summary is sent to the + employee. + +For the weekly email, the setting Leave Weekly Summary Day of Week +allows setting the day of the week in which the email is sent. + +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 +------- + +* ForgeFlow + +Contributors +------------ + +- ForgeFlow + <`http://www.forgeflow.com\\> >`__ + + - Jordi Masvidal + +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. + +.. |maintainer-JordiMForgeFlow| image:: https://github.com/JordiMForgeFlow.png?size=40px + :target: https://github.com/JordiMForgeFlow + :alt: JordiMForgeFlow + +Current `maintainer `__: + +|maintainer-JordiMForgeFlow| + +This module is part of the `OCA/hr-holidays `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_holidays_summary_email/__init__.py b/hr_holidays_summary_email/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/hr_holidays_summary_email/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/hr_holidays_summary_email/__manifest__.py b/hr_holidays_summary_email/__manifest__.py new file mode 100644 index 00000000..c8fad231 --- /dev/null +++ b/hr_holidays_summary_email/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Holidays Summary Email", + "summary": """ + Notify employees with daily or weekly leaves summaries of their company. + """, + "version": "17.0.1.0.0", + "category": "Human Resources", + "website": "https://github.com/OCA/hr-holidays", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["hr_holidays", "hr_holidays_settings"], + "data": [ + "data/ir_cron.xml", + "data/mail_template_data.xml", + "views/hr_employee_views.xml", + "views/res_users_views.xml", + "views/res_config_settings.xml", + ], + "maintainers": ["JordiMForgeFlow"], +} diff --git a/hr_holidays_summary_email/data/ir_cron.xml b/hr_holidays_summary_email/data/ir_cron.xml new file mode 100644 index 00000000..8b17eb4e --- /dev/null +++ b/hr_holidays_summary_email/data/ir_cron.xml @@ -0,0 +1,15 @@ + + + + Leaves Summary Email + + + 1 + days + -1 + + + code + model._cron_send_hr_leave_summary_emails() + + diff --git a/hr_holidays_summary_email/data/mail_template_data.xml b/hr_holidays_summary_email/data/mail_template_data.xml new file mode 100644 index 00000000..876da150 --- /dev/null +++ b/hr_holidays_summary_email/data/mail_template_data.xml @@ -0,0 +1,119 @@ + + + + Leaves Summary: Daily + + Daily Leaves Summary + {{object.work_email}} + {{object.company_id.partner_id.email_formatted}} + +
+

Dear ,

+
+

This is today's leave summary:

+
+ + + + + + + + + + + + + + + + + + +
EmployeeTime OffFromTo
+
+
+ {{object.lang}} + +
+ + Leaves Summary: Weekly + + Weekly Leaves Summary + {{object.work_email}} + {{object.company_id.partner_id.email_formatted}} + +
+

Dear ,

+
+

This is the leaves summary for this week:

+
+ + + + + + + + + + + + + + + + + + +
EmployeeTime OffFromTo
+
+
+ {{object.lang}} + +
+
diff --git a/hr_holidays_summary_email/i18n/hr_holidays_summary_email.pot b/hr_holidays_summary_email/i18n/hr_holidays_summary_email.pot new file mode 100644 index 00000000..62f982db --- /dev/null +++ b/hr_holidays_summary_email/i18n/hr_holidays_summary_email.pot @@ -0,0 +1,219 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_holidays_summary_email +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: hr_holidays_summary_email +#: model:mail.template,body_html:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "" +"
\n" +"

Dear ,

\n" +"
\n" +"

This is the leaves summary for this week:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
EmployeeTime OffFromTo
\n" +"
\n" +" " +msgstr "" + +#. module: hr_holidays_summary_email +#: model:mail.template,body_html:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "" +"
\n" +"

Dear ,

\n" +"
\n" +"

This is today's leave summary:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
EmployeeTime OffFromTo
\n" +"
\n" +" " +msgstr "" + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Weekly Leaves Summary" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_hr_employee_base +msgid "Basic Employee" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_company +msgid "Companies" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__daily +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__daily +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__daily +msgid "Daily" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:mail.template,subject:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "Daily Leaves Summary" +msgstr "" + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Day of week when the weekly leaves summary is sent." +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__4 +msgid "Friday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee__last_hr_leave_summary_sent +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_base__last_hr_leave_summary_sent +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_public__last_hr_leave_summary_sent +msgid "Last Leave Summary Email Sent" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_base__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_public__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_users__hr_leave_summary_type +msgid "Leave Summary Email" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_company__hr_holidays_summary_weekly_dow +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_config_settings__hr_holidays_summary_weekly_dow +msgid "Leave Weekly Summary Day of Week" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.actions.server,name:hr_holidays_summary_email.ir_cron_hr_holidays_summary_email_ir_actions_server +#: model:ir.cron,cron_name:hr_holidays_summary_email.ir_cron_hr_holidays_summary_email +msgid "Leaves Summary Email" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:mail.template,name:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "Leaves Summary: Daily" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:mail.template,name:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "Leaves Summary: Weekly" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__0 +msgid "Monday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__no +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__no +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__no +msgid "No" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__5 +msgid "Saturday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Sending Day Of Week" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__6 +msgid "Sunday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__3 +msgid "Thursday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_hr_leave +msgid "Time Off" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__1 +msgid "Tuesday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_users +msgid "User" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__2 +msgid "Wednesday" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__weekly +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__weekly +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__weekly +msgid "Weekly" +msgstr "" + +#. module: hr_holidays_summary_email +#: model:mail.template,subject:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "Weekly Leaves Summary" +msgstr "" diff --git a/hr_holidays_summary_email/i18n/it.po b/hr_holidays_summary_email/i18n/it.po new file mode 100644 index 00000000..2234d0a1 --- /dev/null +++ b/hr_holidays_summary_email/i18n/it.po @@ -0,0 +1,492 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_holidays_summary_email +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-11 09: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: hr_holidays_summary_email +#: model:mail.template,body_html:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "" +"
\n" +"

Dear ,

\n" +"
\n" +"

This is the leaves summary for this week:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
EmployeeTime OffFromTo
\n" +"
\n" +" " +msgstr "" +"
\n" +"

Spettabile ,

\n" +"
\n" +"

Questo è il riepilogo delle assenze di questa " +"settimana:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
DipendenteAssenzaDalAl
\n" +"
\n" +" " + +#. module: hr_holidays_summary_email +#: model:mail.template,body_html:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "" +"
\n" +"

Dear ,

\n" +"
\n" +"

This is today's leave summary:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
EmployeeTime OffFromTo
\n" +"
\n" +" " +msgstr "" +"
\n" +"

Spettabile ,

\n" +"
\n" +"

Questo è il riepilogo dell'assenza di oggi:

\n" +"
\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
DipendenteAssenzaDaA
\n" +"
\n" +" " + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Weekly Leaves Summary" +msgstr "Riepilogo permessi settimanali" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_hr_employee_base +msgid "Basic Employee" +msgstr "Dipendente base" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__daily +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__daily +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__daily +msgid "Daily" +msgstr "Giornaliero" + +#. module: hr_holidays_summary_email +#: model:mail.template,subject:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "Daily Leaves Summary" +msgstr "Riepilogo permessi giornaliero" + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Day of week when the weekly leaves summary is sent." +msgstr "" +"Girno della settimana in cui viene spedito il riepilogo dei permessi " +"settimanali." + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__4 +msgid "Friday" +msgstr "Venerdì" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee__last_hr_leave_summary_sent +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_base__last_hr_leave_summary_sent +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_public__last_hr_leave_summary_sent +msgid "Last Leave Summary Email Sent" +msgstr "Ultima e-mail ripilogo permesso inviata" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_base__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_hr_employee_public__hr_leave_summary_type +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_users__hr_leave_summary_type +msgid "Leave Summary Email" +msgstr "E-mail riepilogo permesso" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_company__hr_holidays_summary_weekly_dow +#: model:ir.model.fields,field_description:hr_holidays_summary_email.field_res_config_settings__hr_holidays_summary_weekly_dow +msgid "Leave Weekly Summary Day of Week" +msgstr "Giorno della settimana riepilogo settimanale permesso" + +#. module: hr_holidays_summary_email +#: model:ir.actions.server,name:hr_holidays_summary_email.ir_cron_hr_holidays_summary_email_ir_actions_server +#: model:ir.cron,cron_name:hr_holidays_summary_email.ir_cron_hr_holidays_summary_email +msgid "Leaves Summary Email" +msgstr "E-mail riepilogo permessi" + +#. module: hr_holidays_summary_email +#: model:mail.template,name:hr_holidays_summary_email.hr_holidays_summary_mail_template_daily +msgid "Leaves Summary: Daily" +msgstr "Riepilogo assenze: giornaliero" + +#. module: hr_holidays_summary_email +#: model:mail.template,name:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "Leaves Summary: Weekly" +msgstr "Riepilogo assenze: settimanale" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__0 +msgid "Monday" +msgstr "Lunedì" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__no +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__no +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__no +msgid "No" +msgstr "No" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__5 +msgid "Saturday" +msgstr "Sabato" + +#. module: hr_holidays_summary_email +#: model_terms:ir.ui.view,arch_db:hr_holidays_summary_email.res_config_settings_view_form +msgid "Sending Day Of Week" +msgstr "Giorno della settimana spedizione" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__6 +msgid "Sunday" +msgstr "Domenica" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__3 +msgid "Thursday" +msgstr "Giovedì" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_hr_leave +msgid "Time Off" +msgstr "Ferie" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__1 +msgid "Tuesday" +msgstr "Martedì" + +#. module: hr_holidays_summary_email +#: model:ir.model,name:hr_holidays_summary_email.model_res_users +msgid "User" +msgstr "Utente" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__res_company__hr_holidays_summary_weekly_dow__2 +msgid "Wednesday" +msgstr "Mercoledì" + +#. module: hr_holidays_summary_email +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee__hr_leave_summary_type__weekly +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_base__hr_leave_summary_type__weekly +#: model:ir.model.fields.selection,name:hr_holidays_summary_email.selection__hr_employee_public__hr_leave_summary_type__weekly +msgid "Weekly" +msgstr "Settimanale" + +#. module: hr_holidays_summary_email +#: model:mail.template,subject:hr_holidays_summary_email.hr_holidays_summary_mail_template_weekly +msgid "Weekly Leaves Summary" +msgstr "Riepilogo permessi settimanale" + +#~ msgid "" +#~ "
\n" +#~ "

Dear ${object.name},

\n" +#~ "
\n" +#~ "

This is the leaves summary for this week:

\n" +#~ "
\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % set timeoffs = ctx.get('time_offs', False)\n" +#~ " % for data in timeoffs\n" +#~ " % set d_from = data." +#~ "format_hr_leave_summary_date()\n" +#~ " % set d_to = data." +#~ "format_hr_leave_summary_date(False)\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % endfor\n" +#~ "
EmployeeTime OffFromTo
${data.employee_id.name}${data.name or ''}${d_from}${d_to}
\n" +#~ "
\n" +#~ " " +#~ msgstr "" +#~ "
\n" +#~ "

Spettabile ${object.name},

\n" +#~ "
\n" +#~ "

questo è il riepilogo dei permessi di questa " +#~ "settimana:

\n" +#~ "
\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % set timeoffs = ctx.get('time_offs', False)\n" +#~ " % for data in timeoffs\n" +#~ " % set d_from = data." +#~ "format_hr_leave_summary_date()\n" +#~ " % set d_to = data." +#~ "format_hr_leave_summary_date(False)\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % endfor\n" +#~ "
DipendenteTempo assenzaDaA
${data.employee_id.name}${data.name or ''}${d_from}${d_to}
\n" +#~ "
\n" +#~ " " + +#~ msgid "" +#~ "
\n" +#~ "

Dear ${object.name},

\n" +#~ "
\n" +#~ "

This is today's leave summary:

\n" +#~ "
\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % set timeoffs = ctx.get('time_offs', False)\n" +#~ " % for data in timeoffs\n" +#~ " % set d_from = data." +#~ "format_hr_leave_summary_date()\n" +#~ " % set d_to = data." +#~ "format_hr_leave_summary_date(False)\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % endfor\n" +#~ "
EmployeeTime OffFromTo
${data.employee_id.name}${data.name or ''}${d_from}${d_to}
\n" +#~ "
\n" +#~ " " +#~ msgstr "" +#~ "
\n" +#~ "

Spetabile ${object.name},

\n" +#~ "
\n" +#~ "

questo è il ripilogo dei permessi odierni:

\n" +#~ "
\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % set timeoffs = ctx.get('time_offs', False)\n" +#~ " % for data in timeoffs\n" +#~ " % set d_from = data." +#~ "format_hr_leave_summary_date()\n" +#~ " % set d_to = data." +#~ "format_hr_leave_summary_date(False)\n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " \n" +#~ " % endfor\n" +#~ "
DipndenteTempo assenzaDaA
${data.employee_id.name}${data.name or ''}${d_from}${d_to}
\n" +#~ "
\n" +#~ " " + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" + +#~ msgid "Users" +#~ msgstr "Utenti" diff --git a/hr_holidays_summary_email/models/__init__.py b/hr_holidays_summary_email/models/__init__.py new file mode 100644 index 00000000..74ec9fc5 --- /dev/null +++ b/hr_holidays_summary_email/models/__init__.py @@ -0,0 +1,5 @@ +from . import hr_leave +from . import hr_employee +from . import res_company +from . import res_config_settings +from . import res_users diff --git a/hr_holidays_summary_email/models/hr_employee.py b/hr_holidays_summary_email/models/hr_employee.py new file mode 100644 index 00000000..58a23a75 --- /dev/null +++ b/hr_holidays_summary_email/models/hr_employee.py @@ -0,0 +1,18 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class HrEmployeeBase(models.AbstractModel): + _inherit = "hr.employee.base" + + hr_leave_summary_type = fields.Selection( + selection=[("no", "No"), ("daily", "Daily"), ("weekly", "Weekly")], + string="Leave Summary Email", + required=True, + default="no", + ) + last_hr_leave_summary_sent = fields.Date( + string="Last Leave Summary Email Sent", + readonly=True, + ) diff --git a/hr_holidays_summary_email/models/hr_leave.py b/hr_holidays_summary_email/models/hr_leave.py new file mode 100644 index 00000000..74bfa7b6 --- /dev/null +++ b/hr_holidays_summary_email/models/hr_leave.py @@ -0,0 +1,137 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT + + +class HrLeave(models.Model): + _inherit = "hr.leave" + + @api.model + def _get_hr_leave_summary_mail_template(self, summary_type): + return self.env.ref( + "hr_holidays_summary_email.hr_holidays_summary_mail_template_%s" + % summary_type, + raise_if_not_found=False, + ) + + @api.model + def _get_hr_leave_summary_employee_domain(self, summary_type, company_id): + return [ + ("hr_leave_summary_type", "=", summary_type), + ("last_hr_leave_summary_sent", "!=", fields.Date.today()), + ("company_id", "=", company_id), + ] + + @api.model + def _get_hr_leave_summary_base_domain(self, company_id): + return [ + ("state", "=", "validate"), + ("employee_id.company_id", "=", company_id), + ] + + @api.model + def _get_hr_leave_summary_daily_domain(self, company_id): + res = self._get_hr_leave_summary_base_domain(company_id) + res += [ + ("date_from", "<=", fields.Date.today()), + ("date_to", ">=", fields.Date.today()), + ] + return res + + @api.model + def _get_hr_leave_summary_weekly_domain(self, company_id): + res = self._get_hr_leave_summary_base_domain(company_id) + date_from = fields.Date.today() + date_to = date_from + relativedelta(days=6) + res += [ + ("date_from", "<=", date_to), + ("date_to", ">=", date_from), + ] + return res + + @api.model + def _cron_send_hr_leave_summary_emails_daily(self, employees_to_notify, company): + domain = self._get_hr_leave_summary_daily_domain(company.id) + today_time_offs = self.env["hr.leave"].sudo().search(domain) + template = self._get_hr_leave_summary_mail_template("daily") + if not template: + return + for employee in employees_to_notify: + template.with_context(time_offs=today_time_offs).send_mail( + employee.id, force_send=False + ) + employees_to_notify.write({"last_hr_leave_summary_sent": fields.Date.today()}) + + @api.model + def _cron_send_hr_leave_summary_emails_weekly(self, employees_to_notify, company): + if str(fields.Date.today().weekday()) != company.hr_holidays_summary_weekly_dow: + return + domain = self._get_hr_leave_summary_weekly_domain(company.id) + today_time_offs = self.env["hr.leave"].sudo().search(domain) + template = self._get_hr_leave_summary_mail_template("weekly") + if not template: + return + for employee in employees_to_notify: + template.with_context(time_offs=today_time_offs).send_mail( + employee.id, force_send=False + ) + employees_to_notify.write({"last_hr_leave_summary_sent": fields.Date.today()}) + + @api.model + def _cron_send_hr_leave_summary_emails(self): + summary_types = self.env["hr.employee"].fields_get(["hr_leave_summary_type"])[ + "hr_leave_summary_type" + ]["selection"] + for company in self.env["res.company"].search([]): + for stype_tuple in summary_types: + stype = stype_tuple[0] + employee_domain = self._get_hr_leave_summary_employee_domain( + stype, company.id + ) + employees_to_notify = self.env["hr.employee"].search(employee_domain) + if employees_to_notify and hasattr( + self, "_cron_send_hr_leave_summary_emails_%s" % stype + ): + getattr(self, "_cron_send_hr_leave_summary_emails_%s" % stype)( + employees_to_notify, company + ) + + def format_hr_leave_summary_date(self, date_from=True): + self.ensure_one() + if date_from: + res = self.date_from.strftime(DEFAULT_SERVER_DATE_FORMAT) + else: + res = self.date_to.strftime(DEFAULT_SERVER_DATE_FORMAT) + if self.request_unit_half: + res += ( + " %s" + % dict( + self.env["hr.leave"].fields_get(["request_date_from_period"])[ + "request_date_from_period" + ]["selection"] + )[self.request_date_from_period] + ) + elif self.request_unit_hours: + if date_from: + res += ( + " %s" + % dict( + self.env["hr.leave"].fields_get(["request_hour_from"])[ + "request_hour_from" + ]["selection"] + )[self.request_hour_from] + ) + else: + res += ( + " %s" + % dict( + self.env["hr.leave"].fields_get(["request_hour_to"])[ + "request_hour_to" + ]["selection"] + )[self.request_hour_to] + ) + return res diff --git a/hr_holidays_summary_email/models/res_company.py b/hr_holidays_summary_email/models/res_company.py new file mode 100644 index 00000000..03b36d56 --- /dev/null +++ b/hr_holidays_summary_email/models/res_company.py @@ -0,0 +1,23 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + hr_holidays_summary_weekly_dow = fields.Selection( + selection=[ + ("0", "Monday"), + ("1", "Tuesday"), + ("2", "Wednesday"), + ("3", "Thursday"), + ("4", "Friday"), + ("5", "Saturday"), + ("6", "Sunday"), + ], + string="Leave Weekly Summary Day of Week", + default="0", + required=True, + ) diff --git a/hr_holidays_summary_email/models/res_config_settings.py b/hr_holidays_summary_email/models/res_config_settings.py new file mode 100644 index 00000000..9d914966 --- /dev/null +++ b/hr_holidays_summary_email/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + hr_holidays_summary_weekly_dow = fields.Selection( + related="company_id.hr_holidays_summary_weekly_dow", + readonly=False, + required=True, + ) diff --git a/hr_holidays_summary_email/models/res_users.py b/hr_holidays_summary_email/models/res_users.py new file mode 100644 index 00000000..18843d5f --- /dev/null +++ b/hr_holidays_summary_email/models/res_users.py @@ -0,0 +1,19 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResUser(models.Model): + _inherit = "res.users" + + hr_leave_summary_type = fields.Selection( + related="employee_id.hr_leave_summary_type", readonly=False, related_sudo=False + ) + + @property + def SELF_READABLE_FIELDS(self): + return super().SELF_READABLE_FIELDS + ["hr_leave_summary_type"] + + @property + def SELF_WRITEABLE_FIELDS(self): + return super().SELF_WRITEABLE_FIELDS + ["hr_leave_summary_type"] diff --git a/hr_holidays_summary_email/pyproject.toml b/hr_holidays_summary_email/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/hr_holidays_summary_email/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_holidays_summary_email/readme/CONTRIBUTORS.md b/hr_holidays_summary_email/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..2dbb5119 --- /dev/null +++ b/hr_holidays_summary_email/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- ForgeFlow \ + + > - Jordi Masvidal diff --git a/hr_holidays_summary_email/readme/DESCRIPTION.md b/hr_holidays_summary_email/readme/DESCRIPTION.md new file mode 100644 index 00000000..f35078f6 --- /dev/null +++ b/hr_holidays_summary_email/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module allows sending a daily/weekly email to employees with a +summary of the leaves on that period of other employees in the same +company. diff --git a/hr_holidays_summary_email/readme/USAGE.md b/hr_holidays_summary_email/readme/USAGE.md new file mode 100644 index 00000000..7539e349 --- /dev/null +++ b/hr_holidays_summary_email/readme/USAGE.md @@ -0,0 +1,10 @@ +For each employee, three options can be selected for the Leave Summary +Email configuration: + +- No: No email with the leaves summary is sent to the employee. +- Daily: A daily email with the leaves summary is sent to the employee. +- Weekly: A weekly email with the leaves summary is sent to the + employee. + +For the weekly email, the setting Leave Weekly Summary Day of Week +allows setting the day of the week in which the email is sent. diff --git a/hr_holidays_summary_email/static/description/icon.png b/hr_holidays_summary_email/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/hr_holidays_summary_email/static/description/icon.png differ diff --git a/hr_holidays_summary_email/static/description/index.html b/hr_holidays_summary_email/static/description/index.html new file mode 100644 index 00000000..eb8bc01a --- /dev/null +++ b/hr_holidays_summary_email/static/description/index.html @@ -0,0 +1,448 @@ + + + + + +Holidays Summary Email + + + +
+

Holidays Summary Email

+ + +

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

+

This module allows sending a daily/weekly email to employees with a +summary of the leaves on that period of other employees in the same +company.

+

Table of contents

+ +
+

Usage

+

For each employee, three options can be selected for the Leave Summary +Email configuration:

+
    +
  • No: No email with the leaves summary is sent to the employee.
  • +
  • Daily: A daily email with the leaves summary is sent to the employee.
  • +
  • Weekly: A weekly email with the leaves summary is sent to the +employee.
  • +
+

For the weekly email, the setting Leave Weekly Summary Day of Week +allows setting the day of the week in which the email is sent.

+
+
+

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

+
    +
  • ForgeFlow
  • +
+
+
+

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.

+

Current maintainer:

+

JordiMForgeFlow

+

This module is part of the OCA/hr-holidays project on GitHub.

+

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

+
+
+
+ + diff --git a/hr_holidays_summary_email/tests/__init__.py b/hr_holidays_summary_email/tests/__init__.py new file mode 100644 index 00000000..dfe66941 --- /dev/null +++ b/hr_holidays_summary_email/tests/__init__.py @@ -0,0 +1 @@ +from . import test_hr_leave_summary_email diff --git a/hr_holidays_summary_email/tests/test_hr_leave_summary_email.py b/hr_holidays_summary_email/tests/test_hr_leave_summary_email.py new file mode 100644 index 00000000..9aab1215 --- /dev/null +++ b/hr_holidays_summary_email/tests/test_hr_leave_summary_email.py @@ -0,0 +1,94 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from datetime import date, datetime + +from dateutil.relativedelta import relativedelta + +from odoo.tests import common + + +class TestHrLeaveSummaryEmail(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.HrLeave = cls.env["hr.leave"] + leave_type = cls.env.ref("hr_holidays.hr_holiday_status_dv") + # Add allocation days for the test + leave_type.write({"requires_allocation": "no"}) + calendar = cls.env.ref("resource.resource_calendar_std") + cls.employee = cls.env["hr.employee"].create( + { + "name": "Test employee", + "resource_calendar_id": calendar.id, + } + ) + # Today leave + cls.leave_1 = ( + cls.env["hr.leave"] + .with_context(leave_skip_state_check=True) + .create( + { + "name": "Test 1", + "employee_id": cls.employee.id, + "holiday_status_id": leave_type.id, + "request_date_from": datetime.today(), + "request_date_to": (datetime.today() + relativedelta(days=1)), + "number_of_days": 1, + "state": "validate", + } + ) + ) + + # Week leave + cls.leave_2 = ( + cls.env["hr.leave"] + .with_context(leave_skip_state_check=True) + .create( + { + "name": "Test 2", + "employee_id": cls.employee.id, + "holiday_status_id": leave_type.id, + "request_date_from": (datetime.today() + relativedelta(days=3)), + "request_date_to": (datetime.today() + relativedelta(days=5)), + "number_of_days": 2, + "state": "validate", + } + ) + ) + + def test_hr_leave_summary_no(self): + """ + No email sent with the default setting in the employee + """ + self.HrLeave._cron_send_hr_leave_summary_emails() + self.assertFalse(self.employee.last_hr_leave_summary_sent) + + def test_hr_leave_summary_daily(self): + """ + Today's active leave is part of the daily email, but the other not. + """ + domain = self.HrLeave._get_hr_leave_summary_daily_domain(self.env.company.id) + today_time_offs = self.HrLeave.search(domain) + self.assertIn(self.leave_1, today_time_offs) + self.assertNotIn(self.leave_2, today_time_offs) + self.employee.write({"hr_leave_summary_type": "daily"}) + self.HrLeave._cron_send_hr_leave_summary_emails() + self.assertEqual(self.employee.last_hr_leave_summary_sent, date.today()) + + def test_hr_leave_summary_weekly(self): + """ + Today's active leave is part of the daily email, as well as the other + in the same week. + """ + domain = self.HrLeave._get_hr_leave_summary_weekly_domain(self.env.company.id) + today_time_offs = self.HrLeave.search(domain) + self.assertIn(self.leave_1, today_time_offs) + self.assertIn(self.leave_2, today_time_offs) + self.employee.write( + {"hr_leave_summary_type": "weekly", "last_hr_leave_summary_sent": False} + ) + self.env.company.write( + {"hr_holidays_summary_weekly_dow": str(date.today().weekday())} + ) + self.HrLeave._cron_send_hr_leave_summary_emails() + self.assertEqual(self.employee.last_hr_leave_summary_sent, date.today()) diff --git a/hr_holidays_summary_email/views/hr_employee_views.xml b/hr_holidays_summary_email/views/hr_employee_views.xml new file mode 100644 index 00000000..67f6f2fb --- /dev/null +++ b/hr_holidays_summary_email/views/hr_employee_views.xml @@ -0,0 +1,27 @@ + + + + + hr.employee.view.form - hr_holidays_summary_email + hr.employee + + + + + + + + + hr.employee.public.form - hr_holidays_summary_email + hr.employee.public + + + + + + + + diff --git a/hr_holidays_summary_email/views/res_config_settings.xml b/hr_holidays_summary_email/views/res_config_settings.xml new file mode 100644 index 00000000..bf5efebf --- /dev/null +++ b/hr_holidays_summary_email/views/res_config_settings.xml @@ -0,0 +1,43 @@ + + + + + res.config.settings.form - hr_holidays_summary_email + res.config.settings + + + +
+
+
+ Weekly Leaves Summary +
+ Day of week when the weekly leaves summary is sent. +
+
+
+
+
+
+
+
+
+
diff --git a/hr_holidays_summary_email/views/res_users_views.xml b/hr_holidays_summary_email/views/res_users_views.xml new file mode 100644 index 00000000..962a593b --- /dev/null +++ b/hr_holidays_summary_email/views/res_users_views.xml @@ -0,0 +1,15 @@ + + + + res.users.preferences.form.inherit - hr_holidays_summary_email + res.users + + + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..d6f24930 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +odoo-addon-hr_holidays_settings @ git+https://github.com/OCA/hr-holidays.git@refs/pull/154/head#subdirectory=hr_holidays_settings +odoo-addon-hr_leave_custom_hour_interval @ git+https://github.com/OCA/hr-holidays.git@refs/pull/165/head#subdirectory=hr_leave_custom_hour_interval