diff --git a/beesdoo_shift/models/attendance_sheet.py b/beesdoo_shift/models/attendance_sheet.py
index 85791d8..b86fd1d 100644
--- a/beesdoo_shift/models/attendance_sheet.py
+++ b/beesdoo_shift/models/attendance_sheet.py
@@ -306,6 +306,12 @@ class AttendanceSheet(models.Model):
)
def on_barcode_scanned(self, barcode):
+ if self.env.user.has_group("beesdoo_shift.group_shift_attendance"):
+ raise UserError(
+ _("You must be logged as 'Attendance Sheet Generic Access' "
+ " if you want to scan cards.")
+ )
+
if self.state == "validated":
raise UserError(
_("A validated attendance sheet can't be modified")
@@ -564,7 +570,7 @@ class AttendanceSheet(models.Model):
)
# Open a validation wizard only if not admin
- if self.env.user.has_group("beesdoo_shift.group_cooperative_admin"):
+ if self.env.user.has_group("beesdoo_shift.group_shift_attendance_sheet_validation"):
if not self.worker_nb_feedback:
raise UserError(
_("Please give your feedback about the number of workers.")
diff --git a/beesdoo_shift/security/group.xml b/beesdoo_shift/security/group.xml
index 4c4197e..bc64bed 100644
--- a/beesdoo_shift/security/group.xml
+++ b/beesdoo_shift/security/group.xml
@@ -4,17 +4,20 @@
+
+ Attendance Sheet Validation
+
+
+
- Shift and Worker Access
-
+ Shift and Worker Read Access
+
+
- Shift Management
-
-
+ Shifts and Attendance Sheets Management
+
+
Planning Management
@@ -25,10 +28,11 @@
Cooperative Admin
-
-
+
+
diff --git a/beesdoo_shift/security/ir.model.access.csv b/beesdoo_shift/security/ir.model.access.csv
index 54c57d2..76458a3 100644
--- a/beesdoo_shift/security/ir.model.access.csv
+++ b/beesdoo_shift/security/ir.model.access.csv
@@ -12,13 +12,13 @@ access_beesdoo_shift_daynumber,access_beesdoo_shift_daynumber,model_beesdoo_shif
read_beesdoo_shift_planning,read_beesdoo_shift_planning,model_beesdoo_shift_planning,,1,0,0,0
access_beesdoo_shift_template,access_beesdoo_shift_template,model_beesdoo_shift_template,group_shift_attendance,1,0,0,0
write_beesdoo_shift_shift,write_beesdoo_shift_shift,model_beesdoo_shift_shift,group_shift_attendance,1,1,0,0
-manage_beesdoo_shift_shift,manage_beesdoo_shift_shift,model_beesdoo_shift_shift,group_shift_management,1,1,1,1
+manage_beesdoo_shift_shift,manage_beesdoo_shift_shift,model_beesdoo_shift_shift,group_shift_attendance,1,1,1,1
manage_beesdoo_shift_type,manage_beesdoo_shift_type,model_beesdoo_shift_type,group_planning_management,1,1,1,1
manage_beesdoo_shift_daynumber,manage_beesdoo_shift_daynumber,model_beesdoo_shift_daynumber,group_planning_management,1,1,1,1
manage_beesdoo_shift_planning,manage_beesdoo_shift_planning,model_beesdoo_shift_planning,group_planning_management,1,1,1,1
manage_beesdoo_shift_template,manage_beesdoo_shift_template,model_beesdoo_shift_template,group_planning_management,1,1,1,1
-manage_beesdoo_shift_sheet_shift,beesdoo_shift_sheet_shift,model_beesdoo_shift_sheet_shift,group_cooperative_admin,1,1,1,1
-manage_beesdoo_shift_sheet_expected,manage_beesdoo_shift_sheet_expected,model_beesdoo_shift_sheet_expected,group_cooperative_admin,1,1,1,1
+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
manage_cooperative_status,manage_cooperative_status,model_cooperative_status,group_cooperative_admin,1,1,1,1
manage_cooperative_exempt_reason,manage_cooperative_exempt_reason,model_cooperative_exempt_reason,group_cooperative_admin,1,1,1,1
read_beesdoo_shift_journal,read_beesdoo_shift_journal,model_beesdoo_shift_journal,group_cooperative_admin,1,0,1,1
diff --git a/beesdoo_shift/tests/test_beesdoo_shift.py b/beesdoo_shift/tests/test_beesdoo_shift.py
index 7b3f358..a97fbb7 100644
--- a/beesdoo_shift/tests/test_beesdoo_shift.py
+++ b/beesdoo_shift/tests/test_beesdoo_shift.py
@@ -257,6 +257,7 @@ class TestBeesdooShift(TransactionCase):
self.user_generic
)._generate_attendance_sheet()
sheet_1 = self.search_sheets(self.start_in_1, self.end_in_1,)
+ sheet_1 = sheet_1.sudo(self.user_generic)
"""
Expected workers are :
@@ -354,14 +355,6 @@ class TestBeesdooShift(TransactionCase):
}
)
- # Wait necessary time for shifts to begin
- waiting_time = (self.start_in_1 - datetime.now()).total_seconds()
- if waiting_time > 0:
- with self.assertRaises(UserError) as e:
- sheet_1.validate_with_checks()
- self.assertIn("wait", str(e.exception))
- time.sleep(waiting_time)
-
# TODO: test validation with wizard (as generic user)
# class odoo.tests.common.Form(recordp, view=None)
# is only available from version 12
@@ -370,6 +363,15 @@ class TestBeesdooShift(TransactionCase):
# Validation without wizard (as admin user)
sheet_1 = sheet_1.sudo(self.user_admin)
+
+ # Wait necessary time for shifts to begin
+ waiting_time = (self.start_in_1 - datetime.now()).total_seconds()
+ if waiting_time > 0:
+ with self.assertRaises(UserError) as e:
+ sheet_1.validate_with_checks()
+ self.assertIn("wait", str(e.exception))
+ time.sleep(waiting_time)
+
sheet_1.worker_nb_feedback = "enough"
sheet_1.feedback = "Great session."
sheet_1.notes = "Important information."
diff --git a/beesdoo_shift/views/attendance_sheet.xml b/beesdoo_shift/views/attendance_sheet.xml
index e8dee8a..a3480fd 100644
--- a/beesdoo_shift/views/attendance_sheet.xml
+++ b/beesdoo_shift/views/attendance_sheet.xml
@@ -147,11 +147,11 @@