[FIX] hr_holidays: remove time off type if no employee_id
Steps to reproduce: ------------------- - go to the hr leave form; - select "By Employee" mode; - select an employee-based leave type; (example: Paid Time Off (20 remaining out of 20 days)) - change mode with "By Company"; Issue: ------ A specific leave to one employee can be validated for all employees of a company. Cause: ------ The `_compute_from_employee_id` method does not set the `holiday_status_id` field to `False` in this case. Solution: --------- When we detect an `employee_id` change and it is `False`, we must remove the current `holiday_status_id`. opw-3386332 closes odoo/odoo#129653 X-original-commit: a7a8e78103962844d7d3752d41f9ca4b22165569 Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -455,7 +455,7 @@ class HolidaysRequest(models.Model):
|
||||
holiday.manager_id = holiday.employee_id.parent_id.id
|
||||
if holiday.holiday_status_id.requires_allocation == 'no':
|
||||
continue
|
||||
if len(holiday.employee_ids) > 1:
|
||||
if not holiday.employee_id or len(holiday.employee_ids) > 1:
|
||||
holiday.holiday_status_id = False
|
||||
elif holiday.employee_id.user_id != self.env.user and holiday._origin.employee_id != holiday.employee_id:
|
||||
if holiday.employee_id and not holiday.holiday_status_id.with_context(employee_id=holiday.employee_id.id).has_valid_allocation:
|
||||
|
||||
Reference in New Issue
Block a user