From f1c637b1dcc2f5211a24495cc424d51685be60c3 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 14 Oct 2014 16:32:09 +0200 Subject: [PATCH] [FIX] mail_thread: allow to pass mail_track_log_only in the context to remove the subtype of the notification. By this way, no mails will be sent because partners_to_notify will be empty. --- addons/mail/mail_thread.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 981c8db32ba..495b8418045 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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: