Commit 2d43394f by Yvon

a reopened shift registration can be reopened as a makeup and is now identified as reopened

parent 043e2a4b
Pipeline #2829 failed with stage
in 1 minute 6 seconds
...@@ -306,13 +306,15 @@ class CagetteShift(models.Model): ...@@ -306,13 +306,15 @@ class CagetteShift(models.Model):
cond = [['partner_id', '=', int(data['idPartner'])], cond = [['partner_id', '=', int(data['idPartner'])],
['shift_id', '=', int(data['idShift'])], ['shift_id', '=', int(data['idShift'])],
['state', '=', 'cancel']] ['state', '=', 'cancel']]
fields = ['id'] fields = ['id','origin']
try: try:
canceled_res = self.o_api.search_read('shift.registration', cond, fields, 1) canceled_res = self.o_api.search_read('shift.registration', cond, fields, 1)
if (len(canceled_res) == 1): if (len(canceled_res) == 1):
shift_res = canceled_res[0] shift_res = canceled_res[0]
fieldsDatas = { "related_shift_state":'open', fieldsDatas = { "related_shift_state":'open',
"state": 'open'} "state": 'open',
"is_makeup":data['is_makeup'],
"origin":canceled_res[0]['origin'] + ' reopened from memberspace' }
response = self.o_api.update('shift.registration', [shift_res['id']], fieldsDatas) response = self.o_api.update('shift.registration', [shift_res['id']], fieldsDatas)
except Exception as e: except Exception as e:
coop_logger.error("Reopen shift : %s", str(e)) coop_logger.error("Reopen shift : %s", str(e))
......
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