Skip to content

Commit

Permalink
Merge PR #1267 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Dec 10, 2024
2 parents 27eb488 + c6a8be9 commit 01099ce
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hr_employee_birthday_mail/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HR Employee Birthday Mail
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:78b7ea0d8f32fb8ad80ea3e33eb8a629c4e28541d987bc8899134009bc9aa659
!! source digest: sha256:0459daf58a691fcbcf0b1c2154fad1cfab0d7c402279f32dc055cd36abc6cd8f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
7 changes: 6 additions & 1 deletion hr_employee_birthday_mail/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr",
"depends": ["hr", "mail"],
"data": ["data/data.xml", "data/ir_cron.xml", "views/hr_employee_views.xml"],
"data": [
"data/data.xml",
"data/ir_cron.xml",
"views/hr_employee_views.xml",
"views/res_user_views.xml",
],
"installable": True,
"application": False,
"auto_install": False,
Expand Down
1 change: 1 addition & 0 deletions hr_employee_birthday_mail/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import hr_employee
from . import res_user
2 changes: 2 additions & 0 deletions hr_employee_birthday_mail/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ class HrEmployee(models.Model):
default=False,
help="Check this box if you want to allow birthday wishes from our company "
"and allow the others to be notified of your birthday.",
groups="hr.group_hr_user",
)
notify_others_birthday = fields.Boolean(
default=False,
help="Check this box if you want to be notified about other coworkers' birthdays.",
groups="hr.group_hr_user",
)

@api.model
Expand Down
31 changes: 31 additions & 0 deletions hr_employee_birthday_mail/models/res_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class User(models.Model):
_inherit = ["res.users"]

allow_birthday_wishes = fields.Boolean(
related="employee_id.allow_birthday_wishes", readonly=False, related_sudo=False
)
notify_others_birthday = fields.Boolean(
related="employee_id.notify_others_birthday", readonly=False, related_sudo=False
)

def __init__(self, pool, cr):
"""Override of __init__ to add access rights.
Access rights are disabled by default, but allowed
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
"""
super(User, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_READABLE_FIELDS = type(self).SELF_READABLE_FIELDS + [
"allow_birthday_wishes",
"notify_others_birthday",
]
type(self).SELF_WRITEABLE_FIELDS = type(self).SELF_WRITEABLE_FIELDS + [
"allow_birthday_wishes",
"notify_others_birthday",
]
2 changes: 1 addition & 1 deletion hr_employee_birthday_mail/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">HR Employee Birthday Mail</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:78b7ea0d8f32fb8ad80ea3e33eb8a629c4e28541d987bc8899134009bc9aa659
!! source digest: sha256:0459daf58a691fcbcf0b1c2154fad1cfab0d7c402279f32dc055cd36abc6cd8f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr/tree/14.0/hr_employee_birthday_mail"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_employee_birthday_mail"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>The module automates the process of sending out personalized birthday emails to the celebrating employee while also informing their coworkers about the special day. It encourages a culture of mutual respect, camaraderie, and celebration within the team.</p>
Expand Down
20 changes: 20 additions & 0 deletions hr_employee_birthday_mail/views/res_user_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_users_birthday_mail_inherit" model="ir.ui.view">
<field name="name">res.users.birthday.mail.inherit</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="hr.res_users_view_form_profile" />
<field name="arch" type="xml">
<field name="birthday" position="after">
<field
name="allow_birthday_wishes"
attrs="{'readonly': [('can_edit', '=', False)]}"
/>
<field
name="notify_others_birthday"
attrs="{'readonly': [('can_edit', '=', False)], 'invisible': [('allow_birthday_wishes', '=', False)]}"
/>
</field>
</field>
</record>
</odoo>

0 comments on commit 01099ce

Please sign in to comment.