summaryrefslogtreecommitdiff
path: root/addons/hr_holidays
diff options
context:
space:
mode:
authorKevin Baptiste <kba@odoo.com>2021-03-04 16:01:00 +0000
committerKevin Baptiste <kba@odoo.com>2021-03-09 10:39:06 +0000
commit2e225179bf3fb6ed98fa51f9fceca6f286a70b85 (patch)
treeb09376fdb1e51930049ee2aa619a1de4cbc87e3d /addons/hr_holidays
parenta2a45539ca4056eb3b3d5d6bafbfb63c10255843 (diff)
[FIX] hr_holidays: Initialize hr.employee.public view after hr.employee.public
Purpose ====== Currently, in some rare cases, if the hr.employee.public is initialized before the hr.employee.public table, this could lead to a traceback or even some inconsistencies when computing the field current_leave_id, probably because of the MRO graph construction (to be investigated). Specification ========= 1/ Ensure the table existence 2/ Set a dummy value for current_leave_id to force the recomputation to a valid one. opw-2476677 closes odoo/odoo#67518 X-original-commit: 568ed9cde99bbcd6f3d390ec235c86c504466551 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Signed-off-by: Kevin Baptiste <kba@odoo.com>
Diffstat (limited to 'addons/hr_holidays')
-rw-r--r--addons/hr_holidays/models/hr_employee.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/hr_holidays/models/hr_employee.py b/addons/hr_holidays/models/hr_employee.py
index 4fe06f6a857..7585a67cfe7 100644
--- a/addons/hr_holidays/models/hr_employee.py
+++ b/addons/hr_holidays/models/hr_employee.py
@@ -204,3 +204,13 @@ class HrEmployeeBase(models.AbstractModel):
allocations = self.env['hr.leave.allocation'].sudo().search([('state', 'in', ['draft', 'confirm']), ('employee_id', 'in', self.ids)])
allocations.write(hr_vals)
return res
+
+class HrEmployeePrivate(models.Model):
+ _inherit = 'hr.employee'
+
+class HrEmployeePublic(models.Model):
+ _inherit = 'hr.employee.public'
+
+ def _compute_leave_status(self):
+ super()._compute_leave_status()
+ self.current_leave_id = False