From ec6ce50423ecac9c0e4287b8555e421ac727b1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 18 Oct 2023 17:30:43 +0200 Subject: [PATCH] Always return an integer when counting records for marketing scenario and activities --- modules/marketing_automation/marketing_automation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/marketing_automation/marketing_automation.py b/modules/marketing_automation/marketing_automation.py index 2ad87d6320..799cba3148 100644 --- a/modules/marketing_automation/marketing_automation.py +++ b/modules/marketing_automation/marketing_automation.py @@ -146,7 +146,7 @@ class Scenario(Workflow, ModelSQL, ModelView): else: others.append(scenario) - count = {name: dict.fromkeys(map(int, scenarios)) for name in names} + count = {name: defaultdict(int) for name in names} for sub in grouped_slice(others): cursor.execute(*record.select( record.scenario, @@ -436,8 +436,7 @@ class Activity(ModelSQL, ModelView): record_activity = RecordActivity.__table__() cursor = Transaction().connection.cursor() - count = {name: dict.fromkeys(map(int, activities), 0) - for name in names} + count = {name: defaultdict(int) for name in names} for sub in grouped_slice(activities): cursor.execute(*record_activity.select( record_activity.activity,