Browse Source

[FIX] fix singleton error

pull/1/head
houssine 6 years ago
parent
commit
aa6ef89207
  1. 7
      easy_my_coop/models/coop.py

7
easy_my_coop/models/coop.py

@ -28,6 +28,9 @@ class subscription_request(models.Model):
if vals.get('no_registre'):
cooperator = self.env['res.partner'].get_cooperator_from_nin(vals.get('no_registre'))
if cooperator:
# TODO remove the following line of code once it has
# been founded a way to avoid dubble entry
cooperator = cooperator[0]
if cooperator.member:
vals['type'] = 'increase'
vals['already_cooperator'] = True
@ -35,8 +38,8 @@ class subscription_request(models.Model):
vals['type'] = 'subscription'
vals['partner_id'] = cooperator.id
if not cooperator.cooperator:
cooperator.cooperator = True
if not cooperator.cooperator:
cooperator.write({'cooperator':True})
subscr_request = super(subscription_request, self).create(vals)
mail_template_obj = self.env['mail.template']

Loading…
Cancel
Save