From de95e79417acb308580297b826ec8335db551cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 6 Jun 2023 12:55:12 +0200 Subject: [PATCH] Fallback to empty string when column path is NULL Closes #12235 --- trytond/trytond/model/fields/many2one.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trytond/trytond/model/fields/many2one.py b/trytond/trytond/model/fields/many2one.py index dcecb9df3e..0e3a9a1816 100644 --- a/trytond/trytond/model/fields/many2one.py +++ b/trytond/trytond/model/fields/many2one.py @@ -133,6 +133,7 @@ class Many2One(Field): red_sql = reduce_ids(table.id, (i for i in ids if i is not None)) Target = self.get_target() path_column = getattr(Target, self.path).sql_column(table) + path_column = Coalesce(path_column, '') cursor.execute(*table.select(path_column, where=red_sql)) if operator.endswith('child_of'): where = Or()