[FIX] hr_holidays_ux: splits multi-month leaves in write and create.#55
[FIX] hr_holidays_ux: splits multi-month leaves in write and create.#55ced-adhoc wants to merge 1 commit intoingadhoc:18.0from
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements automatic splitting of multi-month leave records in the HR holidays system. The changes enhance user experience by automatically handling leaves that span across multiple months during both creation and modification operations.
- Refactored the
split_daysmethod for improved clarity and efficiency - Added automatic leave splitting functionality to both
createandwritemethods - Implemented helper methods for date conversion and overlap detection to prevent duplicate records
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
b1592e8 to
65120cc
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| first_vals.update(first_split) | ||
|
|
||
| # Update current record with first split period | ||
| super().write(first_vals) |
There was a problem hiding this comment.
Calling super().write() inside a loop for individual records can cause issues with the ORM. The write method is designed to handle recordsets, but here it's being called on individual records within the loop. This should be super(HrLeave, record).write(first_vals) or the loop should be restructured to handle the recordset properly.
| super().write(first_vals) | |
| super(HrLeave, record).write(first_vals) |
| super().write(vals) | ||
| else: | ||
| # No splitting needed, process normally | ||
| super().write(vals) |
There was a problem hiding this comment.
Similar to the previous issue, calling super().write(vals) within a loop over individual records can cause problems. The write method expects to be called on the entire recordset, not individual records within a loop. Consider restructuring to collect records that don't need splitting and call write once, or use super(HrLeave, record).write(vals).
65120cc to
1cfb70a
Compare
1cfb70a to
1d53bc4
Compare
1d53bc4 to
2dcd765
Compare
| date_from = self._convert_to_date(date_from) | ||
| date_to = self._convert_to_date(date_to) | ||
| last_day_of_month = self.get_last_day_of_month(date_from) | ||
| return date_to > last_day_of_month |
There was a problem hiding this comment.
Quizas no son necesarias las variables y se puede hacer directamente la comparación
|
@roboadhoc r+ |
closes #55 Signed-off-by: Matias Velazquez <mav@adhoc.com.ar>

No description provided.