Skip to content

Commit

Permalink
Merge PR #1358 into 16.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 68175dd + 3d0da8b commit 7e35b34
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 2 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 @@ -2,7 +2,7 @@
HR Employee Birthday Mail
=========================

..
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
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
29 changes: 29 additions & 0 deletions hr_employee_birthday_mail/models/res_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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
)

@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + [
"allow_birthday_wishes",
"notify_others_birthday",
]

@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + [
"allow_birthday_wishes",
"notify_others_birthday",
]
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 7e35b34

Please sign in to comment.