|
@ -190,9 +190,8 @@ class Task(models.Model): |
|
|
ABSENT = self.env.ref('beesdoo_shift.absent') |
|
|
ABSENT = self.env.ref('beesdoo_shift.absent') |
|
|
EXCUSED = self.env.ref('beesdoo_shift.excused') |
|
|
EXCUSED = self.env.ref('beesdoo_shift.excused') |
|
|
NECESSITY = self.env.ref('beesdoo_shift.excused_necessity') |
|
|
NECESSITY = self.env.ref('beesdoo_shift.excused_necessity') |
|
|
|
|
|
|
|
|
if not (self.worker_id or self.replaced_id) and new_stage in (DONE, ABSENT, EXCUSED, NECESSITY): |
|
|
if not (self.worker_id or self.replaced_id) and new_stage in (DONE, ABSENT, EXCUSED, NECESSITY): |
|
|
raise UserError(_("You cannot change to the status %s if the is no worker defined on the shift") % new_stage.name) |
|
|
|
|
|
|
|
|
raise UserError(_("You cannot change to the status %s if no worker is defined for the shift") % new_stage.name) |
|
|
|
|
|
|
|
|
if update or not (self.worker_id or self.replaced_id): |
|
|
if update or not (self.worker_id or self.replaced_id): |
|
|
return |
|
|
return |
|
@ -233,7 +232,7 @@ class Task(models.Model): |
|
|
data['irregular_absence_counter'] = -1 |
|
|
data['irregular_absence_counter'] = -1 |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
raise UserError(_("The worker has not a proper working mode define, please check the worker is subscribed")) |
|
|
|
|
|
|
|
|
raise UserError(_("Working mode is not properly defined. Please check if the worker is subscribed")) |
|
|
status.sudo()._change_counter(data) |
|
|
status.sudo()._change_counter(data) |
|
|
self._set_revert_info(data, status) |
|
|
self._set_revert_info(data, status) |
|
|
|
|
|
|
|
|