Commit ed2c7916 by Yvon Kerdoncuff

fix two issues in code to register absences to a service from admin badgeuse :…

fix two issues in code to register absences to a service from admin badgeuse : missing self. + handle exception (cannot marshal thread lock)
parent f89645c8
Pipeline #4172 canceled with stage
......@@ -912,12 +912,21 @@ class CagetteService(models.Model):
partner_ids.append(int(r['partner_id'][0]))
#TODO : improve name of following method
canceled_reg_ids, excluded_partner, ids = CagetteServices.fetch_registrations_infos_excluding_exempted_people(
api, partner_ids, res
self.o_api, partner_ids, res
)
f = {'state': absence_status, 'date_closed': now.isoformat()}
update_shift_reg_result = {'update': self.o_api.update('shift.registration', ids, f), 'reg_shift': res, 'errors': []}
try:
update_shift_reg_result = {'update': self.o_api.update('shift.registration', ids, f), 'reg_shift': res, 'errors': []}
except Exception as e:
if not ("cannot marshal" in str(e)):
raise e
else:
update_shift_reg_result = {'update': True, 'reg_shift': None, 'errors': []}
coop_logger.error("after calling update_shift_reg_result")
if update_shift_reg_result['update'] is True:
update_shift_reg_result['process_status_res'] = self.o_api.execute('res.partner','run_process_target_status', [])
# With new way of overriding awesomefoodcoop status management, the following line is no more useful
# update_shift_reg_result['process_status_res'] = self.o_api.execute('res.partner','run_process_target_status', [])
# change shift state by triggering button_done method for all related shifts
if len(canceled_reg_ids) > 0:
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