Skip to content

Conversation

@fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Mar 25, 2025

[FIX] resource: make sure flexible resource don't use attendances

This commit makes sure the resource calendar attendance is not used for
a flexible resource even if that resource has a working schedule
with hours per day equals to 0 hour.

Remark: this fix has been moved in #202849

[FIX] hr: recompute is_flexible when working schedule becomes flexible

Before this commit, when the user sets a working schedule to an employee
and convert that working schedule into a flexible working schedule, the
employee is not considered as working with flexible hours.

This commit makes sure the _compute_is_flexible method defined in
hr.employee model is triggered when the flexible_hours field of the
working schedule linked to the employee is altered.

Steps to reproduce the issue:

  1. Install Attendance app (hr_attendance module).
  2. Set a working schedule A to employee E
  3. Go to the form view of the working schedule A and check Flexible Hours field to convert the working schedule as flexible working
    schedule.
  4. Go to Attendance app

Expected Behavior:

The Attendance app should loaded without any issue.

Current Behavior:

A traceback is occurred saying we have a division by zero.

opw-4492625

Forward-Port-Of: #203253

@robodoo
Copy link
Contributor

robodoo commented Mar 25, 2025

Pull request status dashboard

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Mar 25, 2025
@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 25, 2025

@xavierbol @tivisse cherrypicking of pull request #203253 failed.

stdout:

Auto-merging addons/resource/models/resource_calendar.py
CONFLICT (content): Merge conflict in addons/resource/models/resource_calendar.py

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 25, 2025
@tivisse
Copy link
Contributor

tivisse commented Mar 26, 2025

Hello @xavierbol

Feel free to solve the conflict when you got some time.

Thanks :)

Before this commit, when the user sets a working schedule to an employee
and convert that working schedule into a flexible working schedule, the
employee is not considered as working with flexible hours.

This commit makes sure the `_compute_is_flexible` method defined in
`hr.employee` model is triggered when the `flexible_hours` field of the
working schedule linked to the employee is altered.

Steps to reproduce the issue:
-----------------------------

0. Install Attendance app (`hr_attendance` module).
1. Set a working schedule A to employee E
2. Go to the form view of the working schedule A and check `Flexible
   Hours` field to convert the working schedule as flexible working
   schedule.
3. Go to Attendance app

Expected Behavior:
-----------------

The Attendance app should loaded without any issue.

Current Behavior:
----------------

A traceback is occurred saying we have a division by zero.

opw-4492625
@xavierbol xavierbol force-pushed the saas-18.1-18.0-attendance-fix-xbo-425248-fw branch from fa7465c to 0069091 Compare March 26, 2025 15:01
@xavierbol
Copy link
Contributor

The first commit has been moved in #202849 to merge as quicker as possible the second commit which is more important for the customers.

@C3POdoo C3POdoo requested a review from a team March 26, 2025 15:14
Copy link
Contributor

@xavierbol xavierbol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo r+

robodoo pushed a commit that referenced this pull request Mar 26, 2025
Before this commit, when the user sets a working schedule to an employee
and convert that working schedule into a flexible working schedule, the
employee is not considered as working with flexible hours.

This commit makes sure the `_compute_is_flexible` method defined in
`hr.employee` model is triggered when the `flexible_hours` field of the
working schedule linked to the employee is altered.

Steps to reproduce the issue:
-----------------------------

0. Install Attendance app (`hr_attendance` module).
1. Set a working schedule A to employee E
2. Go to the form view of the working schedule A and check `Flexible
   Hours` field to convert the working schedule as flexible working
   schedule.
3. Go to Attendance app

Expected Behavior:
-----------------

The Attendance app should loaded without any issue.

Current Behavior:
----------------

A traceback is occurred saying we have a division by zero.

opw-4492625

closes #203358

Related: odoo/enterprise#82125
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
@robodoo robodoo closed this Mar 26, 2025
@fw-bot fw-bot deleted the saas-18.1-18.0-attendance-fix-xbo-425248-fw branch April 2, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants