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: