Browse Source

[IMP] handle the case where the one to which we transfer is a candidate

11.0
houssine 6 years ago
parent
commit
eb4e1133ce
  1. 6
      easy_my_coop/models/operation_request.py

6
easy_my_coop/models/operation_request.py

@ -246,10 +246,10 @@ class operation_request(models.Model):
raise ValidationError(_("Converting just part of the" raise ValidationError(_("Converting just part of the"
" shares is not yet implemented")) " shares is not yet implemented"))
elif rec.operation_type == 'transfer': elif rec.operation_type == 'transfer':
sequence_id = self.env.ref('easy_my_coop.sequence_subscription', False)
if rec.receiver_not_member: if rec.receiver_not_member:
partner = rec.subscription_request.create_coop_partner() partner = rec.subscription_request.create_coop_partner()
# get cooperator number # get cooperator number
sequence_id = self.env.ref('easy_my_coop.sequence_subscription', False)
sub_reg_num = int(sequence_id.next_by_id()) sub_reg_num = int(sequence_id.next_by_id())
partner_vals = sub_request.get_eater_vals(partner, rec.share_product_id) partner_vals = sub_request.get_eater_vals(partner, rec.share_product_id)
partner_vals['member'] = True partner_vals['member'] = True
@ -257,7 +257,11 @@ class operation_request(models.Model):
partner.write(partner_vals) partner.write(partner_vals)
rec.partner_id_to = partner rec.partner_id_to = partner
else: else:
# means an old member or cooperator candidate
if not rec.partner_id_to.member: if not rec.partner_id_to.member:
if rec.partner_id_to.cooperator_register_number == 0:
sub_reg_num = int(sequence_id.next_by_id())
partner_vals['cooperator_register_number'] = sub_reg_num
partner_vals = sub_request.get_eater_vals( partner_vals = sub_request.get_eater_vals(
rec.partner_id_to, rec.partner_id_to,
rec.share_product_id) rec.share_product_id)

Loading…
Cancel
Save