From ffa28488bed9e5d259d45c6737673a886c09270f Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 28 Sep 2015 17:04:32 +0200 Subject: [PATCH] [FIX] mail: subscribe to threads before sending first message Users subscribed to creation of records (new leads in a sales team, new tasks in a project, etc.) are never notified. The reason is that users were subscribed after the record creation notification. Introduced in 43915a872176fd7b8f75fccb73230ea6ad9e1016 Closes #8723 --- addons/mail/mail_thread.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ecfdff68390..ee4eafc3edd 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -387,6 +387,13 @@ class mail_thread(osv.AbstractModel): name = ir_model_pool.read(cr, uid, ids, ['name'], context=context)[0]['name'] self.message_post(cr, uid, thread_id, body=_('%s created') % name, context=context) + # auto_subscribe: take values and defaults into account + create_values = dict(values) + for key, val in context.iteritems(): + if key.startswith('default_') and key[8:] not in create_values: + create_values[key[8:]] = val + self.message_auto_subscribe(cr, uid, [thread_id], create_values.keys(), context=context, values=create_values) + # track values track_ctx = dict(context) if 'lang' not in track_ctx: @@ -397,13 +404,6 @@ class mail_thread(osv.AbstractModel): initial_values = {thread_id: dict.fromkeys(tracked_fields, False)} self.message_track(cr, uid, [thread_id], tracked_fields, initial_values, context=track_ctx) - # auto_subscribe: take values and defaults into account - create_values = dict(values) - for key, val in context.iteritems(): - if key.startswith('default_') and key[8:] not in create_values: - create_values[key[8:]] = val - self.message_auto_subscribe(cr, uid, [thread_id], create_values.keys(), context=context, values=create_values) - return thread_id def write(self, cr, uid, ids, values, context=None):