Commit 812d3b54 by Damien Moulard

Merge branch '4395-rattrapage-sur-shift-annulé' into 'dev_cooperatic'

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

See merge request !230
parents e3b59184 2d43394f
Pipeline #2868 failed with stage
in 1 minute 5 seconds
......@@ -306,13 +306,15 @@ class CagetteShift(models.Model):
cond = [['partner_id', '=', int(data['idPartner'])],
['shift_id', '=', int(data['idShift'])],
['state', '=', 'cancel']]
fields = ['id']
fields = ['id','origin']
try:
canceled_res = self.o_api.search_read('shift.registration', cond, fields, 1)
if (len(canceled_res) == 1):
shift_res = canceled_res[0]
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)
except Exception as 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