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

        issue11856
        review433681006
        (grafted from f15a6a30deefaf3f25715f8a673b83eef1284be4)
diffstat:

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

diffs (18 lines):

diff -r 58df59941e17 -r 19d5ed26673f marketing_automation.py
--- a/marketing_automation.py   Mon Oct 31 17:09:13 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