-
- Downloads
[FIX] calendar: recurring events have wrong end date
Steps to reproduce: - Install Online Appointments - Go to Calendar > Online Appointments > create a new one - Add an available employee like "Mitchell Admin" - Make a slot for each week day at 8:00 - Go to the Calendar of the employee and create a recurrent meeting from 6:00 to 12:00 which repeats everyday for 10 days - Go to the Online Appointments you created then click the button "Go to Website" Bug: You can still make an appointment when the employee is busy. Explanation: Recurring events had their stop date always set to one hour after their start date. So, appointments could still be made two hours after the start date. As seen here: https://github.com/odoo/odoo/blob/ee76b25b003f96073f78420960e216acf14bf821/addons/calendar/models/calendar.py#L47 `with_date` is passed to `timedelta()`. And passing `hours=True` works as if `True` was `1`. ```python >>> from datetime import timedelta >>> timedelta(hours=True) datetime.timedelta(seconds=3600) ``` This fix reproduces the behavior before this commit introduced the bug: https://github.com/odoo/odoo/commit/9920f20e4c7753bc17bea71dea3a90f7de687196 That is, if no duration is given or duration is `0`, one hour is used instead. This bug probably occured because of the naming of the definition: https://github.com/odoo/odoo/blob/ee76b25b003f96073f78420960e216acf14bf821/addons/calendar/models/calendar.py#L33 In fact, `with_date` can be interpreted as being boolean, and the `False` default isn't helping against that. A possibly better alternative to this could be: ```python def calendar_id2real_id(calendar_id=None, duration=None): ``` opw:2334449 closes odoo/odoo#61823 Signed-off-by:backspac <backspac@users.noreply.github.com>
Loading
Please register or sign in to comment