Browse Source

[ADD] b_shift : attendance sheet "mark as read" smart button

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
68956c4d6e
  1. 6
      beesdoo_shift/models/attendance_sheet.py
  2. 12
      beesdoo_shift/views/attendance_sheet.xml

6
beesdoo_shift/models/attendance_sheet.py

@ -274,6 +274,12 @@ class AttendanceSheet(models.Model):
"The sheet has already been validated and can't be edited."
)
@api.multi
def button_mark_as_read(self):
if self.is_read:
raise UserError("The sheet has already been marked as read.")
self.is_read = True
@api.constrains("expected_shift_ids", "added_shift_ids")
def _constrain_unique_worker(self):
added_workers = set(self.added_shift_ids.mapped("worker_id").ids)

12
beesdoo_shift/views/attendance_sheet.xml

@ -76,6 +76,13 @@
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="button_mark_as_read" type="object"
class="oe_stat_button" icon="fa-check"
string="Mark as read"
groups="beesdoo_shift.group_cooperative_admin"
/>
</div>
<div class="oe_title">
<h1><field name="name" /></h1>
</div>
@ -94,11 +101,6 @@
<field name="added_shift_ids" />
<h4> Additional important informations </h4>
<field name="annotation" />
<group>
<field name="is_read"
groups="beesdoo_shift.group_cooperative_admin"
/>
</group>
<h4> General feedback </h4>
<field name="feedback" />
<group>

Loading…
Cancel
Save