From ef2a7c8dabd5e7587b678828cfd2419d2bd249c1 Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Sat, 11 Apr 2020 13:51:01 +0200 Subject: [PATCH] [FIX] beesdoo_shift_attendance Modifications needed as module as been split into beesdoo_shift and beesdoo_attendance_sheet --- beesdoo_base/demo/users.xml | 2 -- beesdoo_shift/security/group.xml | 1 - .../data/system_parameter.xml | 12 +++++------ .../models/attendance_sheet.py | 12 +++++------ .../models/res_config_settings.py | 20 +++++++++---------- .../security/ir.model.access.csv | 13 ++++++------ .../tests/test_beesdoo_shift.py | 4 ++-- .../views/attendance_sheet.xml | 4 ++-- .../views/res_config_settings_view.xml | 2 +- .../wizard/validate_attendance_sheet.py | 4 ++-- 10 files changed, 36 insertions(+), 38 deletions(-) diff --git a/beesdoo_base/demo/users.xml b/beesdoo_base/demo/users.xml index 4d40de4..1c57e34 100644 --- a/beesdoo_base/demo/users.xml +++ b/beesdoo_base/demo/users.xml @@ -26,14 +26,12 @@ generic demo - permanent demo - diff --git a/beesdoo_shift/security/group.xml b/beesdoo_shift/security/group.xml index 8876384..61f3553 100644 --- a/beesdoo_shift/security/group.xml +++ b/beesdoo_shift/security/group.xml @@ -2,7 +2,6 @@ Shift and Worker Read Access - Shifts and Attendance Sheets Management diff --git a/beesdoo_shift_attendance/data/system_parameter.xml b/beesdoo_shift_attendance/data/system_parameter.xml index 342f54c..ddece93 100644 --- a/beesdoo_shift_attendance/data/system_parameter.xml +++ b/beesdoo_shift_attendance/data/system_parameter.xml @@ -1,14 +1,14 @@ - - beesdoo_shift.card_support + + beesdoo_shift_attendance.card_support False - - beesdoo_shift.attendance_sheet_generation_interval + + beesdoo_shift_attendance.attendance_sheet_generation_interval 15 - - beesdoo_shift.default_task_type_id + + beesdoo_shift_attendance.pre_filled_task_type_id 1 diff --git a/beesdoo_shift_attendance/models/attendance_sheet.py b/beesdoo_shift_attendance/models/attendance_sheet.py index 6530501..ab29039 100644 --- a/beesdoo_shift_attendance/models/attendance_sheet.py +++ b/beesdoo_shift_attendance/models/attendance_sheet.py @@ -26,11 +26,11 @@ class AttendanceSheetShift(models.Model): parameters = self.env["ir.config_parameter"].sudo() id = int( parameters.get_param( - "beesdoo_shift.pre_filled_task_type_id", default=1 + "beesdoo_shift_attendance.pre_filled_task_type_id", default=1 ) ) task_types = self.env["beesdoo.shift.type"] - return task_types.browse(default_task_type_id) + return task_types.browse(id) # Related actual shift task_id = fields.Many2one("beesdoo.shift.shift", string="Task") @@ -469,7 +469,7 @@ class AttendanceSheet(models.Model): if expected_shift.state != "done": mail_template = self.env.ref( - "beesdoo_shift.email_template_non_attendance", False + "beesdoo_shift_attendance.email_template_non_attendance", False ) mail_template.send_mail(expected_shift.task_id.id, True) @@ -584,7 +584,7 @@ class AttendanceSheet(models.Model): ) # Open a validation wizard only if not admin - if self.env.user.has_group("beesdoo_shift.group_shift_attendance_sheet_validation"): + if self.env.user.has_group("beesdoo_shift_attendance.group_shift_attendance_sheet_validation"): if not self.worker_nb_feedback: raise UserError( _("Please give your feedback about the number of workers.") @@ -611,7 +611,7 @@ class AttendanceSheet(models.Model): current_time = datetime.now() generation_interval_setting = int( self.env["ir.config_parameter"].sudo().get_param( - "beesdoo_shift.attendance_sheet_generation_interval" + "beesdoo_shift_attendance.attendance_sheet_generation_interval" ) ) @@ -648,7 +648,7 @@ class AttendanceSheet(models.Model): if non_validated_sheets: mail_template = self.env.ref( - "beesdoo_shift.email_template_non_validated_sheet", False + "beesdoo_shift_attendance.email_template_non_validated_sheet", False ) for rec in non_validated_sheets: mail_template.send_mail(rec.id, True) diff --git a/beesdoo_shift_attendance/models/res_config_settings.py b/beesdoo_shift_attendance/models/res_config_settings.py index 9e6090e..b1b8d7d 100644 --- a/beesdoo_shift_attendance/models/res_config_settings.py +++ b/beesdoo_shift_attendance/models/res_config_settings.py @@ -11,9 +11,9 @@ class ResConfigSettings(models.TransientModel): card_support = fields.Boolean( string="Scan cooperators cards instead of login for sheets validation", - config_parameter="beesdoo_shift.card_support", + config_parameter="beesdoo_shift_attendance.card_support", ) - task_type_default_id = fields.Many2one( + pre_filled_task_type_id = fields.Many2one( "beesdoo.shift.type", string="Default Task Type", help="Default task type for attendance sheet pre-filling", @@ -24,7 +24,7 @@ class ResConfigSettings(models.TransientModel): string="Time interval for attendance sheet generation", help="Time interval expressed in minutes", required=True, - config_parameter="beesdoo_shift.attendance_sheet_generation_interval", + config_parameter="beesdoo_shift_attendance.attendance_sheet_generation_interval", ) @api.multi @@ -32,14 +32,14 @@ class ResConfigSettings(models.TransientModel): super(ResConfigSettings, self).set_values() parameters = self.env["ir.config_parameter"].sudo() parameters.set_param( - "beesdoo_shift.card_support", str(self.card_support), + "beesdoo_shift_attendance.card_support", str(self.card_support), ) parameters.set_param( - "beesdoo_shift.task_type_default_id", - str(self.task_type_default_id.id), + "beesdoo_shift_attendance.pre_filled_task_type_id", + str(self.pre_filled_task_type_id.id), ) parameters.set_param( - "beesdoo_shift.attendance_sheet_generation_interval", + "beesdoo_shift_attendance.attendance_sheet_generation_interval", str(self.attendance_sheet_generation_interval), ) @@ -49,12 +49,12 @@ class ResConfigSettings(models.TransientModel): res.update( card_support=ast.literal_eval( self.env["ir.config_parameter"].get_param( - "beesdoo_shift.card_support" + "beesdoo_shift_attendance.card_support" ), ), - task_type_default_id=int( + pre_filled_task_type_id=int( self.env["ir.config_parameter"].get_param( - "beesdoo_shift.task_type_default_id" + "beesdoo_shift_attendance.pre_filled_task_type_id" ) ), ) diff --git a/beesdoo_shift_attendance/security/ir.model.access.csv b/beesdoo_shift_attendance/security/ir.model.access.csv index 077ce09..05db33e 100644 --- a/beesdoo_shift_attendance/security/ir.model.access.csv +++ b/beesdoo_shift_attendance/security/ir.model.access.csv @@ -1,12 +1,13 @@ id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink -create_beesdoo_shift_shift,create_edit_beesdoo_shift_shift,model_beesdoo_shift_shift,group_shift_attendance_sheet,1,1,1,0 read_beesdoo_shift_sheet_shift,read_beesdoo_shift_sheet_shift,model_beesdoo_shift_sheet_shift,group_shift_attendance_sheet,1,0,0,0 create_beesdoo_shift_sheet_shift,create_beesdoo_shift_sheet_shift,model_beesdoo_shift_sheet_shift,group_shift_attendance_sheet,1,1,1,0 create_beesdoo_shift_sheet_expected,create_beesdoo_shift_sheet_expected,model_beesdoo_shift_sheet_expected,group_shift_attendance_sheet,1,1,1,0 manage_beesdoo_shift_sheet_added,manage_beesdoo_shift_sheet_added,model_beesdoo_shift_sheet_added,group_shift_attendance_sheet,1,1,1,1 create_beesdoo_shift_sheet,create_beesdoo_shift_sheet,model_beesdoo_shift_sheet,group_shift_attendance_sheet,1,1,1,0 -sheet_access_beesdoo_shift_template,sheet_access_beesdoo_shift_template,model_beesdoo_shift_template,group_shift_attendance_sheet,1,0,0,0 -sheet_access_beesdoo_shift_type,sheet_access_beesdoo_shift_type,model_beesdoo_shift_type,group_shift_attendance_sheet,1,0,0,0 -access_beesdoo_shift_daynumber,access_beesdoo_shift_daynumber,model_beesdoo_shift_daynumber,group_shift_attendance_sheet,1,0,0,0 -manage_beesdoo_shift_sheet_shift,beesdoo_shift_sheet_shift,model_beesdoo_shift_sheet_shift,group_shift_attendance,1,1,1,1 -manage_beesdoo_shift_sheet_expected,manage_beesdoo_shift_sheet_expected,model_beesdoo_shift_sheet_expected,group_shift_attendance,1,1,1,1 \ No newline at end of file + +access_beesdoo_shift_daynumber,access_beesdoo_shift_daynumber,beesdoo_shift.model_beesdoo_shift_daynumber,group_shift_attendance_sheet,1,0,0,0 +sheet_access_beesdoo_shift_type,sheet_access_beesdoo_shift_type,beesdoo_shift.model_beesdoo_shift_type,group_shift_attendance_sheet,1,0,0,0 +sheet_access_beesdoo_shift_template,sheet_access_beesdoo_shift_template,beesdoo_shift.model_beesdoo_shift_template,group_shift_attendance_sheet,1,0,0,0 +create_beesdoo_shift_shift,create_edit_beesdoo_shift_shift,beesdoo_shift.model_beesdoo_shift_shift,group_shift_attendance_sheet,1,1,1,0 +manage_beesdoo_shift_sheet_shift,beesdoo_shift_sheet_shift,model_beesdoo_shift_sheet_shift,beesdoo_shift.group_shift_attendance,1,1,1,1 +manage_beesdoo_shift_sheet_expected,manage_beesdoo_shift_sheet_expected,model_beesdoo_shift_sheet_expected,beesdoo_shift.group_shift_attendance,1,1,1,1 diff --git a/beesdoo_shift_attendance/tests/test_beesdoo_shift.py b/beesdoo_shift_attendance/tests/test_beesdoo_shift.py index 58ce822..c0e84ef 100644 --- a/beesdoo_shift_attendance/tests/test_beesdoo_shift.py +++ b/beesdoo_shift_attendance/tests/test_beesdoo_shift.py @@ -21,7 +21,7 @@ class TestBeesdooShift(TransactionCase): self.shift_expected_model = self.env["beesdoo.shift.sheet.expected"] self.shift_added_model = self.env["beesdoo.shift.sheet.added"] self.pre_filled_task_type_id = self.env["ir.config_parameter"].sudo().get_param( - "beesdoo_shift.pre_filled_task_type_id" + "beesdoo_shift_attendance.pre_filled_task_type_id" ) self.current_time = datetime.now() @@ -388,4 +388,4 @@ class TestBeesdooShift(TransactionCase): sheet_1.added_shift_ids[0].task_id, self.shift_empty_1 ) - # sheet_1.expected_shift_ids[0].worker_id \ No newline at end of file + # sheet_1.expected_shift_ids[0].worker_id diff --git a/beesdoo_shift_attendance/views/attendance_sheet.xml b/beesdoo_shift_attendance/views/attendance_sheet.xml index 50a174c..107aee9 100644 --- a/beesdoo_shift_attendance/views/attendance_sheet.xml +++ b/beesdoo_shift_attendance/views/attendance_sheet.xml @@ -230,8 +230,8 @@ diff --git a/beesdoo_shift_attendance/views/res_config_settings_view.xml b/beesdoo_shift_attendance/views/res_config_settings_view.xml index 55ed7df..96c7faf 100644 --- a/beesdoo_shift_attendance/views/res_config_settings_view.xml +++ b/beesdoo_shift_attendance/views/res_config_settings_view.xml @@ -91,7 +91,7 @@ diff --git a/beesdoo_shift_attendance/wizard/validate_attendance_sheet.py b/beesdoo_shift_attendance/wizard/validate_attendance_sheet.py index 0457cca..e9a6db4 100644 --- a/beesdoo_shift_attendance/wizard/validate_attendance_sheet.py +++ b/beesdoo_shift_attendance/wizard/validate_attendance_sheet.py @@ -22,7 +22,7 @@ class ValidateAttendanceSheet(models.TransientModel): def _get_card_support_setting(self): return ast.literal_eval( self.env["ir.config_parameter"].sudo().get_param( - "beesdoo_shift.card_support" + "beesdoo_shift_attendance.card_support" ) ) @@ -119,7 +119,7 @@ class ValidateAttendanceSheet(models.TransientModel): partner = user.partner_id can_validate = partner.user_ids.has_group( - "beesdoo_shift.group_shift_attendance_sheet_validation" + "beesdoo_shift_attendance.group_shift_attendance_sheet_validation" ) if not partner.super and not can_validate: