Commit 80e725a9 by Administrator

Merge branch…

Merge branch '5766-CAGETTE-gain-de-point-non-souhaitable-dans-des-cas-de-deplacement-de-service' into 'dev_cooperatic'

properly set template_created when reopening registration not as a makeup

See merge request !262
parents 0ef1582e a7254e35
Pipeline #3356 failed with stage
in 1 minute 6 seconds
...@@ -328,11 +328,17 @@ class CagetteShift(models.Model): ...@@ -328,11 +328,17 @@ class CagetteShift(models.Model):
"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 #following code is required to properly set template_created.
However if shift to reopen is not a makeup, counter should not be incremented so template_created should not be changed.""" #TODO : factor with set_shift code
if data["is_makeup"]: shift_type = "standard"
if data['shift_type'] == "ftop" or getattr(settings, 'USE_STANDARD_SHIFT', True) == False:
shift_type = "ftop"
if (shift_type == "standard" and data['is_makeup'] is not True) or shift_type == "ftop":
fieldsDatas['template_created'] = 1 # It's not true but otherwise, presence add 1 standard point , which is not wanted
else: #the else does not exist in set_shift but is mandatory here as template_created value in reopened registration can be any value
fieldsDatas["template_created"] = False 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