Commit c099683e by Yvon Kerdoncuff

fix bug preventing salarie from validating new member created as suppleant (+…

fix bug preventing salarie from validating new member created as suppleant (+ fix default country ID)
parent e02051af
Pipeline #4117 failed with stage
in 0 seconds
......@@ -587,7 +587,7 @@ class CagetteMember(models.Model):
if ('country' in post_data):
if (post_data['country'].lower() == 'france' or
post_data['country'] == ''):
f['country_id'] = getattr(settings, 'FRANCE_ID', 75)
f['country_id'] = getattr(settings, 'FRANCE_ID', 76)
if 'street2' in post_data:
f['street2'] = post_data['street2']
if ('phone' in post_data) and len(post_data['phone']) > 0:
......@@ -642,9 +642,6 @@ class CagetteMember(models.Model):
# if the new member is associated with an already existing member
# then we put the state in "associated" and we create the "associated" member
if 'is_associated_people' in post_data and 'parent_id' in post_data :
fields = {}
fields['cooperative_state'] = 'associated'
api.update('res.partner', [partner_id], fields)
associated_member = {
'email': post_data['_id'],
'name': name,
......@@ -661,6 +658,9 @@ class CagetteMember(models.Model):
'function': function
}
associated_member_id = api.create('res.partner', associated_member)
fields = {}
fields['cooperative_state'] = 'associated'
api.update('res.partner', [partner_id], fields)
am = CagetteMember(associated_member_id)
res['bca'] = am.generate_base_and_barcode(post_data)
# If it's an new associated member with a new partner. Link will be made by the user in BDM/admin
......
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