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

6
beesdoo_shift/views/attendance_sheet.xml

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

Loading…
Cancel
Save