-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b239368
commit 4200ecf
Showing
23 changed files
with
1,107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
====================== | ||
Holidays Summary Email | ||
====================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.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-14-0/hr-holidays-14-0-hr_holidays_summary_email | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/290/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%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. | ||
|
||
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/14.0/hr_holidays_summary_email>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "14.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"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<data 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 | safe}</field> | ||
<field | ||
name="email_from" | ||
>${object.company_id.partner_id.email_formatted | safe}</field> | ||
<field name="body_html" type="html"> | ||
<div style="margin: 0px; padding: 0px;"> | ||
<p>Dear ${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> | ||
% set timeoffs = ctx.get('time_offs', False) | ||
% for data in timeoffs | ||
% set d_from = data.format_hr_leave_summary_date() | ||
% set d_to = data.format_hr_leave_summary_date(False) | ||
<tr> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${data.employee_id.name}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${data.name or ''}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${d_from}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${d_to}</td> | ||
</tr> | ||
% endfor | ||
</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 | safe}</field> | ||
<field | ||
name="email_from" | ||
>${object.company_id.partner_id.email_formatted | safe}</field> | ||
<field name="body_html" type="html"> | ||
<div style="margin: 0px; padding: 0px;"> | ||
<p>Dear ${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> | ||
% set timeoffs = ctx.get('time_offs', False) | ||
% for data in timeoffs | ||
% set d_from = data.format_hr_leave_summary_date() | ||
% set d_to = data.format_hr_leave_summary_date(False) | ||
<tr> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${data.employee_id.name}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${data.name or ''}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${d_from}</td> | ||
<td | ||
style="padding: 5px; border: 1px solid black;" | ||
>${d_to}</td> | ||
</tr> | ||
% endfor | ||
</table> | ||
</div> | ||
</field> | ||
<field name="lang">${object.lang}</field> | ||
<field name="auto_delete" eval="True" /> | ||
</record> | ||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
) |
Oops, something went wrong.