Skip to content

Commit

Permalink
[FIX] l10n_uy_account: valid NIE number
Browse files Browse the repository at this point in the history
Fix para numeros nie que sobrepasan 7 digitos

closes #144

Ticket: 65694
Signed-off-by: Katherine Zaoral <[email protected]>
  • Loading branch information
mem-adhoc authored and zaoral committed Sep 25, 2023
1 parent b7fdcb6 commit 0341aa4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions l10n_uy_account/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ def _l10n_uy_check_nie_ci(self):
is_nie = self.l10n_latam_identification_type_id == self.env.ref('l10n_uy_account.it_nie')
ci_nie_number, digit_ver = ci_nie_number[1 if is_nie else 0 :-1], int(ci_nie_number[-1])

# Si el numero es < 7 digitos completamos con 0 a la derecha
# Si el numero es < 7 digitos completamos con 0 a la izquierda
ci_nie_number = "%07d" % int(ci_nie_number)

random_num = [2, 9, 8, 7, 6, 3, 4, 5]
# si el nie supera > 7 digitos no es un nie valido
if len(ci_nie_number) > 7:
return False

random_num = [2, 9, 8, 7, 6, 3, 4]
sum = 0
for index, digit in enumerate(ci_nie_number):
sum += int(digit) * random_num[index]
Expand Down

0 comments on commit 0341aa4

Please sign in to comment.