diff --git a/beesdoo_shift/models/attendance_sheet.py b/beesdoo_shift/models/attendance_sheet.py
index 9fb7b1b..3af7dce 100644
--- a/beesdoo_shift/models/attendance_sheet.py
+++ b/beesdoo_shift/models/attendance_sheet.py
@@ -154,6 +154,11 @@ class AttendanceSheet(models.Model):
)
end_time = fields.Datetime(string="End Time", required=True, readonly=True)
day = fields.Date(string="Day", compute="_compute_day", store=True)
+ week = fields.Char(
+ string="Week",
+ help="Computed from planning names",
+ compute="_compute_week",
+ )
expected_shift_ids = fields.One2many(
"beesdoo.shift.sheet.expected",
@@ -215,17 +220,19 @@ class AttendanceSheet(models.Model):
)
]
- @api.depends("start_time", "end_time")
+ @api.depends("start_time", "end_time", "week")
def _compute_name(self):
for rec in self:
start_time_dt = fields.Datetime.from_string(rec.start_time)
start_time_dt = fields.Datetime.context_timestamp(
rec, start_time_dt
)
+ name = "[%s] - " % fields.Date.to_string(start_time_dt)
+ if rec.week:
+ name += rec.week + " - "
if rec.time_slot:
- rec.name = (
- fields.Date.to_string(start_time_dt) + " " + rec.time_slot
- )
+ name += rec.time_slot
+ rec.name = name
@api.depends("start_time", "end_time")
def _compute_time_slot(self):
@@ -253,7 +260,8 @@ class AttendanceSheet(models.Model):
Compute Week Name from Planning Name of first expected shift
"""
for rec in self:
- rec.week = rec.expected_shift_ids.task_id.planning_id.name
+ if rec.expected_shift_ids:
+ rec.week = rec.expected_shift_ids[0].task_id.planning_id.name
@api.depends("annotation")
def _compute_is_annotated(self):
diff --git a/beesdoo_shift/security/ir.model.access.csv b/beesdoo_shift/security/ir.model.access.csv
index e576397..8aaa2c6 100644
--- a/beesdoo_shift/security/ir.model.access.csv
+++ b/beesdoo_shift/security/ir.model.access.csv
@@ -8,7 +8,7 @@ create_beesdoo_shift_sheet,create_beesdoo_shift_sheet,model_beesdoo_shift_sheet,
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,1,0,0,0
-read_beesdoo_shift_planning,read_beesdoo_shift_planning,model_beesdoo_shift_planning,group_shift_attendance,1,0,0,0
+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
diff --git a/beesdoo_shift/views/attendance_sheet.xml b/beesdoo_shift/views/attendance_sheet.xml
index f6e2b11..000c521 100644
--- a/beesdoo_shift/views/attendance_sheet.xml
+++ b/beesdoo_shift/views/attendance_sheet.xml
@@ -115,6 +115,7 @@
beesdoo.shift.sheet
+