From 84ef15bb05986c695d3f88365c149da21cbd201b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 Nov 2022 09:53:11 +0100 Subject: [PATCH] Do not write on party if there is no parties to unsubscribe issue11856 review433681006 --- marketing_automation.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/marketing_automation.py b/marketing_automation.py index 92215d0b3e..052ba809ab 100644 --- a/marketing_automation.py +++ b/marketing_automation.py @@ -706,9 +706,11 @@ class Record(ModelSQL, ModelView): for record in records: if record.scenario.unsubscribable: parties[record.record.marketing_party].add(record.scenario.id) - Party.write(*sum(( - ([p], {'marketing_scenario_unsubscribed': [('add', s)]}) - for p, s in parties.items()), ())) + if parties: + Party.write(*sum(( + ([p], {'marketing_scenario_unsubscribed': [ + ('add', s)]}) + for p, s in parties.items()), ())) def get_rec_name(self, name): if self.record: