From 371c01984a6bcea5f6ec7ae30053ea86ef2fe262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 9 Apr 2026 19:20:38 +0200 Subject: [PATCH] Use BIGINT for the party code digit and limit its size to 18 digits Closes #14761 --- modules/party/party.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/party/party.py b/modules/party/party.py index ac7beff344..138bfd663e 100644 --- a/modules/party/party.py +++ b/modules/party/party.py @@ -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