Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] hr_holidays_summary_email #108

Closed
100 changes: 100 additions & 0 deletions hr_holidays_summary_email/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
======================
Holidays Summary Email
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f1265d7ee3d6a0e55298f1e6c7e6d29492327378e1ebde255497ef87ac4b3dd9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/15.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-15-0/hr-holidays-15-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=15.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 <https://github.com/OCA/hr-holidays/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 <https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%0Aversion:%2015.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.

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-JordiMForgeFlow|

This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_summary_email>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions hr_holidays_summary_email/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions hr_holidays_summary_email/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "15.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"],
}
15 changes: 15 additions & 0 deletions hr_holidays_summary_email/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record forcecreate="True" id="ir_cron_hr_holidays_summary_email" model="ir.cron">
<field name="name">Leaves Summary Email</field>
<field eval="True" name="active" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="model_id" ref="model_hr_leave" />
<field name="state">code</field>
<field name="code">model._cron_send_hr_leave_summary_emails()</field>
</record>
</odoo>
119 changes: 119 additions & 0 deletions hr_holidays_summary_email/data/mail_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" ?>
<odoo noupdate="1">
<record id="hr_holidays_summary_mail_template_daily" model="mail.template">
<field name="name">Leaves Summary: Daily</field>
<field name="model_id" ref="hr.model_hr_employee" />
<field name="subject">Daily Leaves Summary</field>
<field name="email_to">{{object.work_email}}</field>
<field
name="email_from"
>{{object.company_id.partner_id.email_formatted}}</field>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p>Dear <t t-out="object.name" />,</p>
<br />
<p>This is today's leave summary:</p>
<br />
<table
style="border-spacing: 0; border-collapse: collapse; width: 100%; text-align: center;"
>
<tr>
<th
style="padding: 5px; border: 1px solid black;"
>Employee</th>
<th
style="padding: 5px; border: 1px solid black;"
>Time Off</th>
<th style="padding: 5px; border: 1px solid black;">From</th>
<th style="padding: 5px; border: 1px solid black;">To</th>
</tr>
<t t-set="timeoffs" t-value="ctx.get('time_offs', [])" />
<t t-foreach="timeoffs" t-as="data">
<t
t-set="d_from"
t-value="data.format_hr_leave_summary_date()"
/>
<t
t-set="d_to"
t-value="data.format_hr_leave_summary_date(False)"
/>
<tr>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="data.employee_id.name"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="data.name or ''"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="d_from"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="d_to"
/></td>
</tr>
</t>
</table>
</div>
</field>
<field name="lang">{{object.lang}}</field>
<field name="auto_delete" eval="True" />
</record>
<record id="hr_holidays_summary_mail_template_weekly" model="mail.template">
<field name="name">Leaves Summary: Weekly</field>
<field name="model_id" ref="hr.model_hr_employee" />
<field name="subject">Weekly Leaves Summary</field>
<field name="email_to">{{object.work_email}}</field>
<field
name="email_from"
>{{object.company_id.partner_id.email_formatted}}</field>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p>Dear <t t-out="object.name" />,</p>
<br />
<p>This is the leaves summary for this week:</p>
<br />
<table
style="border-spacing: 0; border-collapse: collapse; width: 100%; text-align: center;"
>
<tr>
<th
style="padding: 5px; border: 1px solid black;"
>Employee</th>
<th
style="padding: 5px; border: 1px solid black;"
>Time Off</th>
<th style="padding: 5px; border: 1px solid black;">From</th>
<th style="padding: 5px; border: 1px solid black;">To</th>
</tr>
<t t-set="timeoffs" t-value="ctx.get('time_offs', [])" />
<t t-foreach="timeoffs" t-as="data">
<t
t-set="d_from"
t-value="data.format_hr_leave_summary_date()"
/>
<t
t-set="d_to"
t-value="data.format_hr_leave_summary_date(False)"
/>
<tr>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="data.employee_id.name"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="data.name or ''"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="d_from"
/></td>
<td style="padding: 5px; border: 1px solid black;"><t
t-out="d_to"
/></td>
</tr>
</t>
</table>
</div>
</field>
<field name="lang">{{object.lang}}</field>
<field name="auto_delete" eval="True" />
</record>
</odoo>
Loading
Loading