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):
res = {}
# First, update couchdb data
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'],
'city': post_data['city'],
'zip': post_data['zip'],
......@@ -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
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
try:
shift_template = json.loads(post_data['shift_template'])
shift_t_id = shift_template['data']['id']
stype = shift_template['data']['type']
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
# Update couchdb do with new data
......
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