sobjects/notification.py
changeset 10301 729f36a1bcfa
parent 10261 b2f7f03f10b3
parent 10296 df34de44f40f
child 10662 10942ed172de
--- a/sobjects/notification.py	Wed Mar 25 10:10:24 2015 +0100
+++ b/sobjects/notification.py	Wed Apr 22 10:08:14 2015 +0200
@@ -81,7 +81,11 @@
     # this is usually the method to call
     def render_and_send(self, **kwargs):
         """generate and send email messages for this view"""
-        self._cw.vreg.config.sendmails(self.render_emails(**kwargs))
+        # render_emails changes self._cw so cache it here so all mails are sent
+        # after we commit our transaction.
+        cnx = self._cw
+        for msg, recipients in self.render_emails(**kwargs):
+            SendMailOp(cnx, recipients=recipients, msg=msg)
 
     def cell_call(self, row, col=0, **kwargs):
         self.w(self._cw._(self.content) % self.context(**kwargs))