Browse Source

[ADD] b_shift : group_by on worker_no_feedback

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
af43395455
  1. 9
      beesdoo_shift/models/attendance_sheet.py
  2. 3
      beesdoo_shift/views/attendance_sheet.xml

9
beesdoo_shift/models/attendance_sheet.py

@ -88,6 +88,11 @@ class AttendanceSheetShiftExpected(models.Model):
], ],
) )
@api.onchange("replacement_worker_id")
def on_change_replacement_worker(self):
if self.replacement_worker_id:
self.state = "done"
@api.onchange("state") @api.onchange("state")
def on_change_state(self): def on_change_state(self):
if not self.state or self.state == "done": if not self.state or self.state == "done":
@ -551,6 +556,10 @@ class AttendanceSheet(models.Model):
# Open a validation wizard only if not admin # Open a validation wizard only if not admin
if self.env.user.has_group("beesdoo_shift.group_cooperative_admin"): if self.env.user.has_group("beesdoo_shift.group_cooperative_admin"):
if not self.worker_nb_feedback:
raise UserError(
_("Please give your feedback about the number of workers.")
)
self._validate(self.env.user.partner_id) self._validate(self.env.user.partner_id)
return return
return { return {

3
beesdoo_shift/views/attendance_sheet.xml

@ -21,6 +21,9 @@
<group expand="1" string="Group By"> <group expand="1" string="Group By">
<filter string="Day" name="gb_day" <filter string="Day" name="gb_day"
context="{'group_by' : 'start_time:day'}" /> context="{'group_by' : 'start_time:day'}" />
<filter string="Feedback on number of workers"
name="gb_worker_nb_feedback"
context="{'group_by' : 'worker_nb_feedback'}" />
</group> </group>
</search> </search>
</field> </field>

Loading…
Cancel
Save