changeset f15a6a30deef in modules/marketing_automation:default
details: 
https://hg.tryton.org/modules/marketing_automation?cmd=changeset&node=f15a6a30deef
description:
        Do not write on party if there is no parties to unsubscribe

        issue11856
        review433681006
diffstat:

 marketing_automation.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r 0fc79fb608ff -r f15a6a30deef marketing_automation.py
--- a/marketing_automation.py   Mon Oct 31 17:09:14 2022 +0100
+++ b/marketing_automation.py   Sat Nov 05 09:53:11 2022 +0100
@@ -706,9 +706,11 @@
         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:

Reply via email to