Commit 88389f69 by Yvon

template_created must be set to false to fully transform the shift registration…

template_created must be set to false to fully transform the shift registration in a makeup styled one and trigger odoo counter + 1
parent 16a0386b
Pipeline #2888 failed with stage
in 1 minute 8 seconds
...@@ -314,7 +314,12 @@ class CagetteShift(models.Model): ...@@ -314,7 +314,12 @@ class CagetteShift(models.Model):
fieldsDatas = { "related_shift_state":'open', fieldsDatas = { "related_shift_state":'open',
"state": 'open', "state": 'open',
"is_makeup":data['is_makeup'], "is_makeup":data['is_makeup'],
"origin":canceled_res[0]['origin'] + ' reopened from memberspace' } "origin":canceled_res[0]['origin'] + ' reopened from memberspace'}
"""In case shift to reopen is a makeup, we want the counter to be incremented once shift is done
That is why template_created must be set to false
However if shift to reopen is not a makeup, counter should not be incremented so template_created should not be changed."""
if data["is_makeup"]:
fieldsDatas["template_created"] = False
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