Commit 2ec97ba3 by François C.

Modifications shifts.record_absences car certains enregistrements de presences soulevait une erreur

parent e5cd3108
Pipeline #3778 failed with stage
in 44 seconds
...@@ -773,9 +773,17 @@ class CagetteServices(models.Model): ...@@ -773,9 +773,17 @@ class CagetteServices(models.Model):
canceled_reg_ids.append(int(r['id'])) canceled_reg_ids.append(int(r['id']))
# coop_logger.info("Traitement absences shift_registration ids %s", ids) # coop_logger.info("Traitement absences shift_registration ids %s", ids)
f = {'state': absence_status, 'date_closed': now.isoformat()} f = {'state': absence_status, 'date_closed': now.isoformat()}
update_shift_reg_result = {'update': api.update('shift.registration', ids, f), 'reg_shift': res, 'errors': []} update_shift_reg_result = {'update': False, 'reg_shift': res, 'errors': []}
if update_shift_reg_result['update'] is True: individual_update_result = {}
update_shift_reg_result['process_status_res'] = api.execute('res.partner','run_process_target_status', []) for mysregid in ids:
try:
individual_update_result[str(mysregid)] = api.update('shift.registration', [mysregid], f)
except Exception as e:
coop_logger.error("Error on updating shift.registration ids %s : %s", str(mysregid), str(e))
update_shift_reg_result['update'] = individual_update_result
# With new way of overriding awesomefoodcoop status management, the following line is no more useful
# update_shift_reg_result['process_status_res'] = api.execute('res.partner','run_process_target_status', [])
# change shift state by triggering button_done method for all related shifts # change shift state by triggering button_done method for all related shifts
if len(canceled_reg_ids) > 0: if len(canceled_reg_ids) > 0:
f = {'state': 'cancel', 'date_closed': now.isoformat()} f = {'state': 'cancel', 'date_closed': now.isoformat()}
......
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