From 31b5ebd4ebfa4b4bf9be84963eda8c4a72c2b9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 12 Oct 2022 08:25:20 +0200 Subject: [PATCH] Add sql_id method to Reference field and use it for index issue11788 review447351003 --- marketing_automation.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/marketing_automation.py b/marketing_automation.py index 8eafdcb8b4..92215d0b3e 100644 --- a/marketing_automation.py +++ b/marketing_automation.py @@ -21,7 +21,6 @@ from genshi.core import END, START, Attrs, QName from genshi.template import MarkupTemplate, TextTemplate from sql import Literal from sql.aggregate import Count -from sql.functions import Position, Substring from trytond.config import config from trytond.i18n import gettext @@ -222,7 +221,6 @@ class Scenario(Workflow, ModelSQL, ModelView): for scenario in scenarios: Model = pool.get(scenario.model) - sql_int = scenario.__class__.id.sql_type().base record = Record.__table__() cursor = Transaction().connection.cursor() domain = PYSONDecoder({}).decode(scenario.domain) @@ -240,10 +238,7 @@ class Scenario(Workflow, ModelSQL, ModelView): continue cursor.execute(*( query - record.select( - Substring( - record.record, - Position(',', record.record) + Literal(1) - ).cast(sql_int), + Record.record.sql_id(record.record, Model), where=record.scenario == scenario.id))) records = []