[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.

This commit is contained in:
Jeremy Kersten 2014-10-14 16:32:09 +02:00
parent 61207f3f4d
commit f1c637b1dc
1 changed files with 8 additions and 6 deletions

View 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: