[FIX] hr_holidays: Fix out of office message edition

Purpose
=======
Currently, the ooom field is editable in the leave view but an ir.rule
prevents the employee to save as soon as the leave is approved.

Specification
=============
An employee should be able to edit the out of office message
even if the leave is already approved.
This commit is contained in:
Lucas Lefèvre
2019-06-07 12:51:02 +00:00
parent cc6cc7ae8b
commit 8dff37f3ec
+4
View File
@@ -576,6 +576,10 @@ class HolidaysRequest(models.Model):
@api.multi
def write(self, values):
# Allow an employee to always write his own out of office message
if len(self) == 1 and values.keys() == {'out_of_office_message'} and self.employee_id.user_id == self.env.user:
return super(HolidaysRequest, self.sudo()).write(values)
employee_id = values.get('employee_id', False)
if not self.env.context.get('leave_fast_create') and values.get('state'):
self._check_approval_update(values['state'])