Browse Source

[IMP] apply national register number control also for the legal

representative(same field than for a person).
pull/1/head
houssine 7 years ago
parent
commit
208620f53b
  1. 24
      easy_my_coop/models/coop.py

24
easy_my_coop/models/coop.py

@ -88,7 +88,7 @@ class subscription_request(models.Model):
return True return True
@api.multi @api.multi
@api.depends('iban', 'no_registre','skip_control_ng')
@api.depends('iban', 'no_registre','skip_control_ng','is_company',)
def _validated_lines(self): def _validated_lines(self):
for sub_request in self: for sub_request in self:
validated = False validated = False
@ -98,11 +98,11 @@ class subscription_request(models.Model):
except ValidationError: except ValidationError:
validated = False validated = False
if not sub_request.is_company:
if sub_request.skip_control_ng or self.check_belgian_identification_id(sub_request.no_registre):
validated = True
else:
validated = False
#if not sub_request.is_company:
if sub_request.skip_control_ng or self.check_belgian_identification_id(sub_request.no_registre):
validated = True
else:
validated = False
sub_request.validated = validated sub_request.validated = validated
@api.multi @api.multi
@api.depends('share_product_id', 'share_product_id.list_price','ordered_parts') @api.depends('share_product_id', 'share_product_id.list_price','ordered_parts')
@ -302,12 +302,12 @@ class subscription_request(models.Model):
partner = partner_obj.search([('national_register_number','=',self.no_registre)]) partner = partner_obj.search([('national_register_number','=',self.no_registre)])
else: else:
partner = None partner = None
if not partner: if not partner:
partner = self.create_coop_partner() partner = self.create_coop_partner()
else: else:
partner = partner[0] partner = partner[0]
if self.is_company and not partner.has_representative(): if self.is_company and not partner.has_representative():
contact = partner_obj.search([('national_register_number','=',self.no_registre)]) contact = partner_obj.search([('national_register_number','=',self.no_registre)])
if not contact: if not contact:
@ -327,14 +327,14 @@ class subscription_request(models.Model):
raise UserError(_('This contact person is already defined for another company. Please select another contact')) raise UserError(_('This contact person is already defined for another company. Please select another contact'))
else: else:
contact.parent_id = partner.id contact.parent_id = partner.id
invoice = self.create_invoice(partner) invoice = self.create_invoice(partner)
self.write({'partner_id':partner.id, 'state':'done'}) self.write({'partner_id':partner.id, 'state':'done'})
self.create_user(partner) self.create_user(partner)
return invoice return invoice
@api.one @api.one
def block_subscription_request(self): def block_subscription_request(self):
self.write({'state':'block'}) self.write({'state':'block'})

Loading…
Cancel
Save