[17.0][ADD]mail_notify_employee_leave#156
Open
GuillermoNforgeflow wants to merge 1 commit intoOCA:17.0from
Open
[17.0][ADD]mail_notify_employee_leave#156GuillermoNforgeflow wants to merge 1 commit intoOCA:17.0from
GuillermoNforgeflow wants to merge 1 commit intoOCA:17.0from
Conversation
a07e0f3 to
ed43a5c
Compare
acdda41 to
e90ac57
Compare
AndreuOForgeFlow
suggested changes
Mar 5, 2026
63cde2e to
aeced1b
Compare
AndreuOForgeFlow
approved these changes
Mar 19, 2026
aeced1b to
9d30768
Compare
9d30768 to
12ac186
Compare
GuillemCForgeFlow
suggested changes
Apr 24, 2026
Comment on lines
+8
to
+17
| """ | ||
| Override _validate_leave_request to skip absence notifications when | ||
| approving leaves. The context flag 'skip_absence_notification' prevents | ||
| _notify_thread from sending messages, | ||
| """ | ||
| if not self.env.context.get("skip_absence_notification"): | ||
| return super( | ||
| HrLeave, self.with_context(skip_absence_notification=True) | ||
| )._validate_leave_request() | ||
| return super()._validate_leave_request() |
Contributor
There was a problem hiding this comment.
Suggested change
| """ | |
| Override _validate_leave_request to skip absence notifications when | |
| approving leaves. The context flag 'skip_absence_notification' prevents | |
| _notify_thread from sending messages, | |
| """ | |
| if not self.env.context.get("skip_absence_notification"): | |
| return super( | |
| HrLeave, self.with_context(skip_absence_notification=True) | |
| )._validate_leave_request() | |
| return super()._validate_leave_request() | |
| return super(HrLeave, self.with_context(skip_absence_notification=True))._validate_leave_request() |
is there any reason for doing it as such?
| _inherit = "mail.thread" | ||
|
|
||
| def _notify_thread(self, message, msg_vals=False, **kwargs): | ||
| """ |
Contributor
There was a problem hiding this comment.
Suggested change
| """ |
IMHO, we should stick to adding comments in the code only when strictly necessary; this is the same content as what we have in the description.
What'd help more is to have a USAGE.md file to understand more easily the steps you need to do functionally to make it work
| cls.record = cls.env["res.partner"].create({"name": "Test Record"}) | ||
|
|
||
| def test_no_notify_when_user_not_absent(self): | ||
| self.employee.is_absent = False |
Contributor
There was a problem hiding this comment.
this is a computed field. we should create a leave instead to properly test, right?
| self.message_notify( | ||
| partner_ids=[self.env.user.partner_id.id], | ||
| body=body, | ||
| subject="User out of office", |
Contributor
There was a problem hiding this comment.
we can also use the _ for translations here
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This module automatically notifies users when they mention or assign a colleague who is out of office. The notification includes the expected return date of the absent user and is sent only once per day per user.