diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py index 15e528dbaff..c561375dcf6 100644 --- a/addons/event_sale/event_sale.py +++ b/addons/event_sale/event_sale.py @@ -86,9 +86,9 @@ class sale_order_line(osv.osv): 'event_id': order_line.event_id.id, } message = _("The registration has been created for event %s from the Sale Order %s. ") % (order_line.event_id.name, order_line.order_id.name) - context.update({'sale_event': True, 'message': message }) + context.update({'mail_create_nolog': True, 'sale_event': True, 'message': message }) registration_id = registration_obj.create(cr, uid, dic, context=context) - registration_obj.create_send_note(cr, uid, registration_id, context=context) + registration_obj.message_post(cr, uid, registration_id, body=message, context=context) return super(sale_order_line, self).button_confirm(cr, uid, ids, context=context) sale_order_line() @@ -96,14 +96,8 @@ sale_order_line() class event_registration(osv.osv): _inherit = 'event.registration' - # ---------------------------------------- - # OpenChatter methods and notifications - # ---------------------------------------- - - def create_send_note(self, cr, uid, ids, context=None): - if context.get("sale_event") and context.get("message"): - message = context.get("message") - self.message_post(cr, uid, ids, body=message, context=context) - else: - super(event_registration, self).create_send_note(cr, uid, ids, context=context) - return True + def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, content_subtype='html', **kwargs): + """ Overrides mail_thread message_post so that we can set the message note when + a new registration create on the event sale. + """ + return super(event_registration, self).message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs)