Compare commits

...

1 Commits

Author SHA1 Message Date
Rémy Taymans 12d1301205 [FIX] b_shift_attendance: Validate when a shift does not exists 4 years ago
  1. 2
      beesdoo_shift_attendance/__manifest__.py
  2. 23
      beesdoo_shift_attendance/models/attendance_sheet.py

2
beesdoo_shift_attendance/__manifest__.py

@ -11,7 +11,7 @@
"author": "Elouan Le Bars, Coop IT Easy SCRLfs",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Cooperative management",
"version": "12.0.1.0.1",
"version": "12.0.1.0.2",
"depends": [
"beesdoo_base",
"beesdoo_shift",

23
beesdoo_shift_attendance/models/attendance_sheet.py

@ -1,9 +1,14 @@
import logging
from datetime import date, datetime, timedelta
from odoo import _, api, fields, models
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class AttendanceSheetShift(models.Model):
"""
Partial copy of Task class to use in AttendanceSheet,
@ -472,6 +477,24 @@ class AttendanceSheet(models.Model):
# Expected shifts status update
for expected_shift in self.expected_shift_ids:
actual_shift = expected_shift.task_id
if not actual_shift:
_logger.warning(
"The shift linked to the expected shift with id %s "
"for the partner id %s does not exist anymore."
"The expected shift is ignored during the validation "
"process of the attendance sheet."
% (expected_shift.id, expected_shift.worker_id.id)
)
self._message_log(
body=_(
"The shift linked to the expected shift of %s "
"does exist any more."
"This expected shift is ignored in the "
"validation process."
% expected_shift.worker_id.name
)
)
continue
actual_shift.replaced_id = expected_shift.replaced_id
actual_shift.state = expected_shift.state

Loading…
Cancel
Save