Commit 64d51055 by François C.

Merge branch 'hot_fix_member_without_shif_template' into 'dev_cooperatic'

Hot fix member without shif template

See merge request !271
parents 396a54e3 cf673b7e
Pipeline #3421 failed with stage
in 1 minute 7 seconds
...@@ -389,7 +389,7 @@ class CagetteMember(models.Model): ...@@ -389,7 +389,7 @@ class CagetteMember(models.Model):
res = {} res = {}
# First, update couchdb data # First, update couchdb data
c_db = CouchDB(arg_db='member') c_db = CouchDB(arg_db='member')
shift_template = json.loads(post_data['shift_template']) # shift_template = json.loads(post_data['shift_template'])
received_data = {'birthdate': post_data['birthdate'], received_data = {'birthdate': post_data['birthdate'],
'city': post_data['city'], 'city': post_data['city'],
'zip': post_data['zip'], 'zip': post_data['zip'],
...@@ -573,11 +573,14 @@ class CagetteMember(models.Model): ...@@ -573,11 +573,14 @@ class CagetteMember(models.Model):
# We add the associated member to the "associate" shift template so we can find them in Odoo # We add the associated member to the "associate" shift template so we can find them in Odoo
elif 'is_associated_people' not in post_data or 'is_associated_people' in post_data and 'parent_id' not in post_data: elif 'is_associated_people' not in post_data or 'is_associated_people' in post_data and 'parent_id' not in post_data:
# Create shift suscription if is not associated # Create shift suscription if is not associated
shift_template = json.loads(post_data['shift_template']) try:
shift_t_id = shift_template['data']['id'] shift_template = json.loads(post_data['shift_template'])
stype = shift_template['data']['type'] shift_t_id = shift_template['data']['id']
res['shift'] = \ stype = shift_template['data']['type']
m.create_coop_shift_subscription(shift_t_id, stype) res['shift'] = \
m.create_coop_shift_subscription(shift_t_id, stype)
except Exception as no_shift_e:
coop_logger.error("Pas de créneau défini : %s \n %s", str(post_data), str(no_shift_e))
# m.add_first_point(stype) # Not needed anymore # m.add_first_point(stype) # Not needed anymore
# Update couchdb do with new data # Update couchdb do with new data
...@@ -1396,4 +1399,4 @@ class CagetteUser(models.Model): ...@@ -1396,4 +1399,4 @@ class CagetteUser(models.Model):
return answer return answer
from shifts.models import CagetteShift from shifts.models import CagetteShift
\ No newline at end of file
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