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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user