Exemple #1
0
 def _check_cpf(self):
     for record in self:
         country_code = record.country_id.code or ''
         if record.cpf and country_code.upper() == 'BR':
             cpf = misc.punctuation_rm(record.cpf)
             if not fiscal.validate_cpf(cpf):
                 raise ValidationError(_('CPF inválido!'))
         return True
Exemple #2
0
 def _check_cpf(self):
     for record in self:
         country_code = record.country_id.code or ''
         if record.cpf and country_code.upper() == 'BR':
             cpf = re.sub('[^0-9]', '', record.cpf)
             if not fiscal.validate_cpf(cpf):
                 raise ValidationError(_(u'CPF inválido!'))
         return True
    def _check_cnpj_cpf(self):
        check_cnpj_cpf = True

        if self.cnpj_cpf:
            if self.cpfcnpj_type == 'cnpj':
                if not fiscal.validate_cnpj(self.cnpj_cpf):
                    check_cnpj_cpf = False
            elif not fiscal.validate_cpf(self.cnpj_cpf):
                check_cnpj_cpf = False
        if not check_cnpj_cpf:
            raise UserError(
                _(u'CNPJ/CPF do documento relacionado é invalido!'))
 def _check_cnpj_cpf(self):
     result = True
     for record in self:
         country_code = record.country_id.code or ''
         if record.cnpj_cpf and country_code.upper() == 'BR':
             if record.is_company:
                 if not fiscal.validate_cnpj(record.cnpj_cpf):
                     result = False
                     document = u'CNPJ'
             elif not fiscal.validate_cpf(record.cnpj_cpf):
                 result = False
                 document = u'CPF'
         if not result:
             raise ValidationError(u"{} Invalido!".format(document))
Exemple #5
0
 def _validate_cpf(self):
     if self.dependent_cpf:
         if not fiscal.validate_cpf(self.dependent_cpf):
             raise ValidationError(_('Invalid CPF for dependent %s'
                                     % self.dependent_name))
Exemple #6
0
 def _check_cpf(self):
     for record in self:
         if record.cpf and not fiscal.validate_cpf(record.cpf):
             raise ValidationError(u"CPF Invalido!")