[FIX] mail_thread: allow to pass mail_track_log_only in the context to remove the...
authorJeremy Kersten <jke@odoo.com>
Tue, 14 Oct 2014 14:32:09 +0000 (16:32 +0200)
committerJeremy Kersten <jke@odoo.com>
Tue, 14 Oct 2014 14:32:40 +0000 (16:32 +0200)
addons/mail/mail_thread.py

index 981c8db..495b841 100644 (file)
@@ -525,12 +525,14 @@ class mail_thread(osv.AbstractModel):
 
             # find subtypes and post messages or log if no subtype found
             subtypes = []
-            for field, track_info in self._track.items():
-                if field not in changes:
-                    continue
-                for subtype, method in track_info.items():
-                    if method(self, cr, uid, browse_record, context):
-                        subtypes.append(subtype)
+            # By passing this key, that allows to let the subtype empty and so don't sent email because partners_to_notify from mail_message._notify will be empty
+            if not context.get('mail_track_log_only'):
+                for field, track_info in self._track.items():
+                    if field not in changes:
+                        continue
+                    for subtype, method in track_info.items():
+                        if method(self, cr, uid, browse_record, context):
+                            subtypes.append(subtype)
 
             posted = False
             for subtype in subtypes: