Browse Source

[FIX] if the contact already a cooperator the contact wasn't added to

the company
[IMP] add an user error it the contact person is already the contact of
another company
pull/1/head
houssine 7 years ago
parent
commit
422ae34d98
  1. 5
      easy_my_coop/models/coop.py

5
easy_my_coop/models/coop.py

@ -281,6 +281,11 @@ class subscription_request(models.Model):
'lang':self.lang, 'birthdate':self.birthdate, 'parent_id': partner.id, 'lang':self.lang, 'birthdate':self.birthdate, 'parent_id': partner.id,
'function':self.contact_person_function} 'function':self.contact_person_function}
contact = partner_obj.create(contact_vals) contact = partner_obj.create(contact_vals)
else:
if contact.parent_id and contact.parent_id.id != partner.id:
raise UserError(_('This contact person is already defined for another company. Please select another contact'))
else:
contact.parent_id = partner.id
else: else:
partner = partner[0] partner = partner[0]

Loading…
Cancel
Save