changeset 2cab0abcba9c in modules/marketing_automation:default
details: 
https://hg.tryton.org/modules/marketing_automation?cmd=changeset;node=2cab0abcba9c
description:
        Skip record when it is empty

        The Reference value may be None if the target has been deleted despite 
being
        required.

        issue9813
        review331131002
diffstat:

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

diffs (26 lines):

diff -r 4e4cbc54c1fd -r 2cab0abcba9c marketing_automation.py
--- a/marketing_automation.py   Mon Nov 02 16:00:14 2020 +0100
+++ b/marketing_automation.py   Mon Nov 16 21:22:13 2020 +0100
@@ -492,6 +492,10 @@
         RecordActivity = pool.get('marketing.automation.record.activity')
         record = activity.record
 
+        # As it is a reference, the record may have been deleted
+        if not record:
+            return
+
         # XXX: use domain
         if self.condition and not record.eval(self.condition):
             return
@@ -691,7 +695,10 @@
         cls.write(records, {'blocked': True})
 
     def get_rec_name(self, name):
-        return self.record.rec_name
+        if self.record:
+            return self.record.rec_name
+        else:
+            return '(%s)' % self.id
 
     @classmethod
     def create(cls, vlist):

Reply via email to