Browse Source

[REFACT] remove commented code

pull/10/head
houssine 5 years ago
parent
commit
554a4497b1
  1. 18
      easy_my_coop/models/coop.py
  2. 5
      easy_my_coop/models/partner.py
  3. 17
      easy_my_coop/wizard/create_subscription_from_partner.py

18
easy_my_coop/models/coop.py

@ -47,7 +47,7 @@ class subscription_request(models.Model):
vals.get('email'))
if cooperator:
# TODO remove the following line of code once it has
# been founded a way to avoid double entry
# been found a way to avoid double entry
cooperator = cooperator[0]
if cooperator.member:
vals['type'] = 'increase'
@ -88,22 +88,6 @@ class subscription_request(models.Model):
return subscr_request
# def check_belgian_identification_id(self, nat_register_num):
# if not self.check_empty_string(nat_register_num):
# return False
# if len(nat_register_num) != 11:
# return False
# if not nat_register_num.isdigit():
# return False
# birthday_number = nat_register_num[0:9]
# controle = nat_register_num[9:11]
# check_controle = 97 - (int(birthday_number) % 97)
# if int(check_controle) != int(controle):
# check_controle = 97 - ((2000000000 + int(birthday_number)) % 97)
# if int(check_controle) != int(controle):
# return False
# return True
def check_empty_string(self, value):
if value is None or value is False or value == '':
return False

5
easy_my_coop/models/partner.py

@ -171,11 +171,6 @@ class ResPartner(models.Model):
return self.search([('cooperator', '=', True),
('email', '=', email)])
# def get_cooperator_from_nin(self, national_id_number):
# return self.search([('cooperator', '=', True),
# ('national_register_number', '=',
# national_id_number)])
def get_cooperator_from_crn(self, comp_reg_number):
return self.search([('cooperator', '=', True),
('company_register_number', '=', comp_reg_number)])

17
easy_my_coop/wizard/create_subscription_from_partner.py

@ -35,7 +35,7 @@ class PartnerCreateSubscription(models.TransientModel):
return False
@api.model
def _get_representative_mail(self):
def _get_representative_email(self):
representative = self._get_representative()
if representative:
return representative.email
@ -124,14 +124,7 @@ class PartnerCreateSubscription(models.TransientModel):
representative_name = fields.Char(string='Representative name',
default=_get_representative_name)
representative_email = fields.Char(string='Representative email',
default=_get_representative_mail)
# def check_belgian_ident_id(self, register_number):
# sub_req = self.env['subscription.request']
# if sub_req.check_belgian_identification_id(register_number):
# return True
# else:
# raise UserError(_("The national register number is not valid."))
default=_get_representative_email)
@api.multi
def create_subscription(self):
@ -171,10 +164,8 @@ class PartnerCreateSubscription(models.TransientModel):
if self.is_company and not self._get_representative():
representative = False
if self.representative_email:
representative = partner_obj.search([('email',
'=',
self.representative_email
)])
representative = partner_obj.search(
[('email', '=', self.representative_email)])
if representative:
if len(representative) > 1:

Loading…
Cancel
Save