Files
odoo_source/addons/resource/models
aamo-odoo 6a4808802c [FIX] resource: prevent ZeroDivision Error while adding first working hours
This error occurs when the user adds a new "Working Schedule" to the resource,
switches to the two-week calendar view, removes all the existing "Working Hours"
lines, and then attempts to add a new line under "Working Hours."

Steps to reproduce:
- Install "resource" module
- Settings -> Technical -> Resource -> Working Schedules
- New -> Switch to 2 week calendar -> Remove all "Working Hours" lines
- Click on Add a line

Traceback: ZeroDivisionError
float division by zero

This commit implements a check for the variable "number_of_days". If the value
of "number_of_days" is zero or not found, the function will return zero.
This ensures that the function behaves appropriately in cases where the number
of days is zero.

https://github.com/odoo/odoo/blob/5177e21aea68959eedc73e0034ed984992392dd7/addons/resource/models/resource_calendar.py#L185

sentry - 5108250957

closes odoo/odoo#159844

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2024-03-29 12:38:11 +00:00
..
…