|
|
""" Out-of-office is considered as activated once out_of_office_from is
set in the past. "To" is not mandatory, as users could simply deactivate
it when coming back if the leave timerange is unknown. """
now = self.env.cr.now()
todo = self.filtered(lambda u: u.out_of_office_from and u._is_internal())
for user in todo:
if user.out_of_office_to:
user.is_out_of_office = (user.out_of_office_from <= now <= user.out_of_office_to)
else:
user.is_out_of_office = (user.out_of_office_from <= now)
(self - todo).is_out_of_office = False
|
|