From 040b00fa61ff103d04dd46f2afb35c78786e0a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 15 Mar 2025 13:31:57 +0100 Subject: [PATCH] Compare integrity error message with the constraint name prefixed by the table name The TableHandler adds the table name as prefix to the constraint name so when comparing with the integrity error message, it should also be added. Especially if the constraint name is hashed by the TableHandler conversion because the result is completely different. Closes #13922 (grafted from 57e97b6d957e1b472eea3fb7bbdf2ecf03abfc6a) --HG-- branch : 7.0 --- trytond/trytond/model/modelsql.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trytond/trytond/model/modelsql.py b/trytond/trytond/model/modelsql.py index 8be677f820..c104f5aef9 100644 --- a/trytond/trytond/model/modelsql.py +++ b/trytond/trytond/model/modelsql.py @@ -553,6 +553,7 @@ class ModelSQL(ModelStorage): gettext('ir.msg_required_validation', **cls.__names__(field_name))) for name, _, error in cls._sql_constraints: + name = cls._table + '_' + name if backend.TableHandler.convert_name(name) in str(exception): raise SQLConstraintError(gettext(error)) # Check foreign key in last because this can raise false positive