Use BIGINT for the party code digit and limit its size to 18 digits

Closes #14761
This commit is contained in:
Cédric Krier committed 2026-04-09 19:20:38 +02:00
1 parent 3a14737d86
commit 371c01984a
1 file changed
+3 -1
+3 -1
View File
@@ -53,6 +53,7 @@ class Party(
'get_code_readonly')
code_alnum = fields.Char("Code Alphanumeric", readonly=True)
code_digit = fields.Integer("Code Digit", readonly=True)
code_digit._sql_type = 'BIGINT'
lang = fields.MultiValue(
fields.Many2One('ir.lang', "Language",
help="Used to translate communications with the party."))
@@ -306,7 +307,8 @@ class Party(
re.sub(r'[\W_]', '', self.code)
if self.code is not None else None)
try:
values['code_digit'] = int(re.sub(r'\D', '', self.code or ''))
values['code_digit'] = int(
re.sub(r'\D', '', self.code or '')[-18:])
except ValueError:
values['code_digit'] = None
return values