From 347a8161565eaafb2e9839726654eb8d7933ec0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Jun 2024 01:45:21 +0200 Subject: [PATCH] Do not include WHERE clause to constraint if it is None Closes #13315 --- trytond/trytond/backend/sqlite/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/trytond/backend/sqlite/table.py b/trytond/trytond/backend/sqlite/table.py index efb1fef2f2..b27736c29e 100644 --- a/trytond/trytond/backend/sqlite/table.py +++ b/trytond/trytond/backend/sqlite/table.py @@ -279,7 +279,7 @@ class TableHandler(TableHandlerInterface): ident = self.convert_name(self.table_name + "_" + ident) if database.has_constraint(constraint): where = '' - if hasattr(constraint, 'where'): + if getattr(constraint, 'where', None): where = ' WHERE ' + str(constraint.where) cursor.execute( 'CREATE UNIQUE INDEX IF NOT EXISTS %s ON %s (%s) %s' % (