Browse Source

[REF] b_shift : code cleaning

pull/125/head
Elouan Le Bars 5 years ago
parent
commit
55a0ab5646
  1. 37
      beesdoo_shift/models/attendance_sheet.py
  2. 1
      beesdoo_shift/security/group.xml

37
beesdoo_shift/models/attendance_sheet.py

@ -246,7 +246,7 @@ class AttendanceSheet(models.Model):
start_time_dt = fields.Datetime.context_timestamp(
rec, start_time_dt
)
name = "[%s] " % (fields.Date.to_string(start_time_dt),)
name = "[%s] " % fields.Date.to_string(start_time_dt)
if rec.week:
name += rec.week + " "
if rec.day_abbrevation:
@ -277,7 +277,7 @@ class AttendanceSheet(models.Model):
def _compute_week(self):
"""
Compute Week Name from Planning Name
of first expected shift with one
of first expected shift with one.
"""
for rec in self:
for shift in rec.expected_shift_ids:
@ -337,22 +337,31 @@ class AttendanceSheet(models.Model):
)
if worker.state == "unsubscribed":
shift_counter = worker.cooperative_status_ids.sc + worker.cooperative_status_ids.sr
raise UserError(_(
"Beware, your account is frozen because your shift counter "
"is at %s. Please contact Members Office to unfreeze it. "
"If you want to attend this shift, your supercoop "
"can write your name in the notes field during validation."
) % shift_counter)
shift_counter = (
worker.cooperative_status_ids.sc
+ worker.cooperative_status_ids.sr
)
raise UserError(
_(
"Beware, your account is frozen because your shift counter "
"is at %s. Please contact Members Office to unfreeze it. "
"If you want to attend this shift, your supercoop "
"can write your name in the notes field during validation."
)
% shift_counter
)
if worker.state == "resigning":
raise UserError(_(
"Beware, you are recorded as resigning. "
"Please contact member's office if this is incorrect. Thank you."
))
raise UserError(
_(
"Beware, you are recorded as resigning. "
"Please contact member's office if this is incorrect. Thank you."
)
)
if worker.working_mode not in ("regular", "irregular"):
raise UserError(
_("%s is %s and should be regular or irregular.")
% worker.name, worker.working_mode
% worker.name,
worker.working_mode,
)
# expected shifts status update

1
beesdoo_shift/security/group.xml

@ -26,6 +26,7 @@
/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<!-- Could the following be removed ? -->
<record model="ir.ui.menu" id="base.menu_board_root">
<field name="groups_id" eval="[(6,0,[ref('group_shift_attendance_sheet')])]"/>
</record>

Loading…
Cancel
Save