Browse Source

[FIX] b_shift : automatic error message

For regular non-attended not doing
their compensation shift.
pull/125/head
Elouan Le Bars 5 years ago
parent
commit
19eacb2e78
  1. 14
      beesdoo_shift/wizard/validate_attendance_sheet.py

14
beesdoo_shift/wizard/validate_attendance_sheet.py

@ -34,7 +34,8 @@ class ValidateAttendanceSheet(models.TransientModel):
but should be doing their regular shifts. This warning is added
to sheet's notes at validation.
"""
sheet = self.active_sheet
sheet = self._get_active_sheet()
warning_message = ""
if sheet:
for added_shift in sheet.added_shift_ids:
@ -65,8 +66,8 @@ class ValidateAttendanceSheet(models.TransientModel):
default=_get_warning_regular_workers,
help="Is any regular worker doing its regular shift as an added one ?",
)
notes = fields.Text(related="active_sheet.notes")
feedback = fields.Text(related="active_sheet.feedback")
notes = fields.Text(related="active_sheet.notes", default="")
feedback = fields.Text(related="active_sheet.feedback", default="")
worker_nb_feedback = fields.Selection(
related="active_sheet.worker_nb_feedback", required=True
)
@ -84,7 +85,6 @@ class ValidateAttendanceSheet(models.TransientModel):
@api.multi
def validate_sheet(self):
sheet = self.active_sheet
if self.card_support:
# Login with barcode
card = self.env["member.card"].search(
@ -112,6 +112,10 @@ class ValidateAttendanceSheet(models.TransientModel):
)
)
self.notes += self.warning_regular_workers
if self.notes and self.warning_regular_workers:
self.notes += self.warning_regular_workers
elif self.warning_regular_workers:
self.notes = self.warning_regular_workers
self.save()
sheet._validate(partner or self.env.user.partner_id)
Loading…
Cancel
Save