From: Olivier Dony Date: Wed, 14 Dec 2011 14:33:21 +0000 (+0100) Subject: [FIX] share: sent share notifications immediately w/o queuing X-Git-Tag: 6.1.0-rc1-addons~664 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=efc5cabe7a85918fc87d21bf8a300ee24426f8a5;p=odoo%2Fodoo.git [FIX] share: sent share notifications immediately w/o queuing lp bug: https://launchpad.net/bugs/903058 fixed bzr revid: odo@openerp.com-20111214143321-l9r6mdqe2fc7m4t0 --- diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 5f33f02..3466b37 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -689,7 +689,7 @@ class share_wizard(osv.osv_memory): raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) # TODO: also send an HTML version of this mail - emails_sent = 0 + msg_ids = [] for result_line in wizard_data.result_line_ids: email_to = result_line.user_id.user_email subject = wizard_data.name @@ -718,16 +718,16 @@ class share_wizard(osv.osv_memory): body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n" "It is open source and can be found on http://www.openerp.com.") - if mail_message.schedule_with_attach(cr, uid, - user.user_email, - [email_to], - subject, - body, - model='share.wizard'): - emails_sent += 1 - else: - self._logger.warning('Failed to send share notification from %s to %s, ignored', user.user_email, email_to) - self._logger.info('%s share notification(s) successfully sent.', emails_sent) + msg_ids.append(mail_message.schedule_with_attach(cr, uid, + user.user_email, + [email_to], + subject, + body, + model='share.wizard', + context=context)) + # force direct delivery, as users expect instant notification + mail_message.send(cr, uid, msg_ids, context=context) + self._logger.info('%d share notification(s) sent.', len(msg_ids)) share_wizard() class share_result_line(osv.osv_memory):