Commit f37478e9 by Damien Moulard

Merge branch 'ticket_3074' into 'dev_cooperatic'

#3074 Prevent associated people to be granted more than once for having done shift together

See merge request !178
parents 279197e3 b81df9a3
Pipeline #2214 failed with stage
in 2 minutes 6 seconds
......@@ -1456,6 +1456,7 @@ class CagetteServices(models.Model):
# Let's start by adding an extra shift to associated member who came together
cond = [['date_begin', '>=', date_24h_before.isoformat()],
['date_begin', '<=', end_date.isoformat()],
['date_closed', '=', False],
['state', '=', 'done'], ['associate_registered', '=', 'both']]
fields = ['state', 'partner_id', 'date_begin']
res = api.search_read('shift.registration', cond, fields)
......@@ -1495,7 +1496,8 @@ class CagetteServices(models.Model):
(_h, _m, _s) = h.split(':')
if int(_h) < 21:
ids.append(int(r['id']))
f = {'state': absence_status}
# coop_logger.info("Traitement absences shift_registration ids %s", ids)
f = {'state': absence_status, 'date_closed': now.isoformat()}
update_shift_reg_result = {'update': api.update('shift.registration', ids, f), 'reg_shift': res}
if update_shift_reg_result['update'] is True:
update_shift_reg_result['process_status_res'] = api.execute('res.partner','run_process_target_status', [])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment