From 62fca7d44d6d07e059dc38569ea5340c079142ea Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Tue, 26 Nov 2019 15:00:39 +0100 Subject: [PATCH] [REM] b_shift : expected_worker_nb and added_worker_nb from attendance sheet They are already automatically displayed on the form view. --- beesdoo_shift/models/attendance_sheet.py | 18 +----------------- beesdoo_shift/views/attendance_sheet.xml | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/beesdoo_shift/models/attendance_sheet.py b/beesdoo_shift/models/attendance_sheet.py index b96a1c1..eb35b61 100644 --- a/beesdoo_shift/models/attendance_sheet.py +++ b/beesdoo_shift/models/attendance_sheet.py @@ -172,16 +172,6 @@ class AttendanceSheet(models.Model): readonly=True, help="Indicative maximum number of workers for the shifts.", ) - expected_worker_nb = fields.Integer( - string="Number of expected workers", readonly=True, default=0 - ) - added_worker_nb = fields.Integer( - compute="_compute_added_shift_nb", - string="Number of added workers", - readonly=True, - default=0, - ) - annotation = fields.Text( "Annotation", default="" ) @@ -270,10 +260,6 @@ class AttendanceSheet(models.Model): "You can't add the same worker more than once to an attendance sheet." ) - @api.depends("added_shift_ids") - def _compute_added_shift_nb(self): - self.added_worker_nb = len(self.added_shift_ids) - # Compute name (not hardcorded to prevent incoherence with timezone) @api.depends("start_time", "end_time") def _compute_name(self): @@ -330,10 +316,8 @@ class AttendanceSheet(models.Model): } ) task_templates.add(task.task_template_id) - new_sheet.expected_worker_nb += 1 # Maximum number of workers calculation - - new_sheet.max_worker_nb = sum(r.worker_nb for r in task_templates) + new_sheet.max_worker_no = sum(r.worker_nb for r in task_templates) return new_sheet # Workaround to display notifications only for unread and not validated diff --git a/beesdoo_shift/views/attendance_sheet.xml b/beesdoo_shift/views/attendance_sheet.xml index e919bf6..2d11e86 100644 --- a/beesdoo_shift/views/attendance_sheet.xml +++ b/beesdoo_shift/views/attendance_sheet.xml @@ -84,7 +84,7 @@ - +