-
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] hr_employee_birthay_mail: res_users configurable
- Loading branch information
1 parent
15c3b90
commit 3d0da8b
Showing
6 changed files
with
59 additions
and
2 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
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import hr_employee | ||
from . import res_user |
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
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,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", | ||
] |
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,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> |