details:   https://code.tryton.org/tryton/commit/74b151186417
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Sat Jan 10 18:39:18 2026 +0100
description:
        Test the record reference of marketing automation record before 
execution

        The reference field is on the record and not on the record activity.

        Closes #14281
        (grafted from a7bcd29273f4b7cc5d4d8ce8c1a5f86242ece361)
diffstat:

 modules/marketing_automation/marketing_automation.py |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r f1dff2886e67 -r 74b151186417 
modules/marketing_automation/marketing_automation.py
--- a/modules/marketing_automation/marketing_automation.py      Sat Jan 03 
19:18:24 2026 +0100
+++ b/modules/marketing_automation/marketing_automation.py      Sat Jan 10 
18:39:18 2026 +0100
@@ -611,13 +611,13 @@
                     activity=self.rec_name,
                     exception=exception)) from exception
 
-    def execute(self, activity, **kwargs):
+    def execute(self, record_activity, **kwargs):
         pool = Pool()
         RecordActivity = pool.get('marketing.automation.record.activity')
-        record = activity.record
+        record = record_activity.record
 
         # As it is a reference, the record may have been deleted
-        if not record:
+        if not record.record:
             return
 
         # XXX: use domain
@@ -625,7 +625,7 @@
             return
 
         if self.action:
-            getattr(self, 'execute_' + self.action)(activity, **kwargs)
+            getattr(self, 'execute_' + self.action)(record_activity, **kwargs)
         RecordActivity.save([
                 RecordActivity.get(record, child)
                 for child in self.children])
@@ -823,9 +823,10 @@
 
     @property
     def language(self):
-        lang = self.record.marketing_party.lang
-        if lang:
-            return lang.code
+        if self.record:
+            lang = self.record.marketing_party.lang
+            if lang:
+                return lang.code
 
     @dualmethod
     @ModelView.button

Reply via email to