Browse Source

[ADD] b_shift : attended_worker_no

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
6579d9130e
  1. 11
      beesdoo_shift/models/attendance_sheet.py
  2. 8
      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="",
@ -462,6 +467,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
@ -512,6 +520,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

8
beesdoo_shift/views/attendance_sheet.xml

@ -122,6 +122,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>
@ -163,9 +164,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 col="3" string="Feedback"
<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" />
<field name="feedback" />
<field name="worker_nb_feedback" />

Loading…
Cancel
Save