Browse Source

[ADD] b_shift : attended_worker_no

pull/125/head
Elouan Le Bars 5 years ago
parent
commit
51a7323e3a
  1. 11
      beesdoo_shift/models/attendance_sheet.py
  2. 6
      beesdoo_shift/views/attendance_sheet.xml

11
beesdoo_shift/models/attendance_sheet.py

@ -167,6 +167,11 @@ class AttendanceSheet(models.Model):
readonly=True,
help="Indicative maximum number of workers.",
)
attended_worker_no = fields.Integer(
string="Number of workers present",
default=0,
readonly=True,
)
notes = fields.Text(
"Notes",
default="",
@ -472,6 +477,9 @@ class AttendanceSheet(models.Model):
actual_shift.replaced_id = expected_shift.replaced_id
actual_shift.state = expected_shift.state
if expected_shift.state == "done":
self.attended_worker_no += 1
if expected_shift.state != "done":
mail_template = self.env.ref(
"beesdoo_shift.email_template_non_attendance", False
@ -525,6 +533,9 @@ class AttendanceSheet(models.Model):
)
added_shift.task_id = actual_shift.id
if actual_shift.state == "done":
self.attended_worker_no += 1
self.validated_by = user
self.state = "validated"
return

6
beesdoo_shift/views/attendance_sheet.xml

@ -119,6 +119,7 @@
<field name="max_worker_no" type="char"/>
<field name="state" />
<field name="validated_by" />
<field name="attended_worker_no" type="char"/>
<field name="is_annotated" />
</tree>
</field>
@ -164,9 +165,12 @@
<field name="expected_shift_ids" />
<separator string="Added Shifts" style="position:relative;padding:0px;margin-top:15px;margin-bottom:0px;" />
<field name="added_shift_ids" />
<br/>
<group>
<field name="max_worker_no" />
</group>
<group col="1" string="Feedback"
groups="beesdoo_shift.group_shift_attendance">
<field name="attended_worker_no" />
<field name="notes" />
<br/>
<field name="feedback" />

Loading…
Cancel
Save