Browse Source

[ADD] Filter from today to J+ 4

[FIX] Silent error when reverting counter info while status change of task when missing some access right
[IMP] Performance improvement in shift generation: Skip message generation
pull/105/head
Thibault Francois 7 years ago
committed by Elouan
parent
commit
0a871324bc
  1. 7
      beesdoo_shift/models/task.py
  2. 10
      beesdoo_shift/views/task.xml
  3. 2
      beesdoo_shift/wizard/instanciate_planning.py

7
beesdoo_shift/models/task.py

@ -100,12 +100,9 @@ class Task(models.Model):
def _revert(self):
if not self.revert_info:
return
try:
data = json.loads(self.revert_info)
self.env['cooperative.status'].browse(data['status_id'])._change_counter(data['data'])
self.env['cooperative.status'].browse(data['status_id']).sudo()._change_counter(data['data'])
self.revert_info = False
except:
pass
def _update_stage(self, old_stage, new_stage):
self.ensure_one()
@ -160,5 +157,7 @@ class Task(models.Model):
data['irregular_absence_date'] = self.start_time[:10]
data['irregular_absence_counter'] = -1
else:
raise UserError(_("The worker has not a proper working mode define, please check the worker is subscribed"))
status.sudo()._change_counter(data)
self._set_revert_info(data, status)

10
beesdoo_shift/views/task.xml

@ -37,13 +37,15 @@
<filter string="Unassigned" name="unassigned"
domain="[('worker_id', '=', False)]" />
<separator />
<filter string="J-5" name="jminus1"
<filter string="4 next days" name="nextweek"
domain="[('end_time','&gt;', context_today().strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() + datetime.timedelta(days=4)).strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="J-5" name="jminus5"
domain="[('end_time','&gt;', (context_today() - datetime.timedelta(days=5)).strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() - datetime.timedelta(days=5)).strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="J-4" name="jminus1"
<filter string="J-4" name="jminus4"
domain="[('end_time','&gt;', (context_today() - datetime.timedelta(days=4)).strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() - datetime.timedelta(days=4)).strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="J-3" name="jminus1"
<filter string="J-3" name="jminus3"
domain="[('end_time','&gt;', (context_today() - datetime.timedelta(days=3)).strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() - datetime.timedelta(days=3)).strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="J-2" name="jminus1"
<filter string="J-2" name="jminus2"
domain="[('end_time','&gt;', (context_today() - datetime.timedelta(days=2)).strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() - datetime.timedelta(days=2)).strftime('%%Y-%%m-%%d 23:59:59'))]" />
<filter string="J-1" name="jminus1"
domain="[('end_time','&gt;', (context_today() - datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d 00:00:00')), ('start_time','&lt;', (context_today() - datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d 23:59:59'))]" />

2
beesdoo_shift/wizard/instanciate_planning.py

@ -14,7 +14,7 @@ class InstanciatePlanning(models.TransientModel):
@api.multi
def generate_task(self):
self.ensure_one()
self = self.with_context(visualize_date=self.date_start)
self = self.with_context(visualize_date=self.date_start, tracking_disable=True)
shifts = self.planning_id.task_template_ids._generate_task_day()
return {
'name': _('Generated Shift'),

Loading…
Cancel
Save