details:   https://code.tryton.org/tryton/commit/31d0c0660002
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Apr 09 19:20:38 2026 +0200
description:
        Use BIGINT for the party code digit and limit its size to 18 digits

        Closes #14761
diffstat:

 modules/party/party.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 205b618af9b4 -r 31d0c0660002 modules/party/party.py
--- a/modules/party/party.py    Thu Apr 02 19:24:07 2026 +0200
+++ b/modules/party/party.py    Thu Apr 09 19:20:38 2026 +0200
@@ -53,6 +53,7 @@
         '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 @@
                 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

Reply via email to