@api.model
def create(self, vals):
    res = super(EventRegistration, self).create(vals)
    if (res.origin or res.sale_order_id):
        res.message_post_with_view('mail.message_origin_link', values={'self': res, 'origin': res.sale_order_id}, subtype_id=self.env.ref('mail.mt_note').id)
    return res
@api.model
def create(self, vals):
    res = super(EventRegistration, self).create(vals)
    if (res.origin or res.sale_order_id):
        res.message_post_with_view('mail.message_origin_link', values={'self': res, 'origin': res.sale_order_id}, subtype_id=self.env.ref('mail.mt_note').id)
    return res