Browse Source

[FIX] when partner was already in the database.

pull/89/head
houssine 5 years ago
parent
commit
4a3d2e6c6b
  1. 7
      easy_my_coop/models/coop.py

7
easy_my_coop/models/coop.py

@ -482,8 +482,6 @@ class subscription_request(models.Model):
if self.ordered_parts <= 0: if self.ordered_parts <= 0:
raise UserError(_('Number of share must be greater than 0.')) raise UserError(_('Number of share must be greater than 0.'))
if self.partner_id: if self.partner_id:
if not self.partner_id.cooperator:
self.partner_id.cooperator = True
partner = self.partner_id partner = self.partner_id
else: else:
partner = None partner = None
@ -504,6 +502,11 @@ class subscription_request(models.Model):
else: else:
partner = partner[0] partner = partner[0]
partner.write({
"cooperator": True,
"customer": self.share_product_id.customer
})
if self.is_company and not partner.has_representative(): if self.is_company and not partner.has_representative():
contact = False contact = False
if self.email: if self.email:

Loading…
Cancel
Save