When I need something like this I have a dummy wizard with message field, and have a simple form view that show the value of that field.
When ever I want to show a message after clicking on a button I do this:
@api.multi
def action_of_button(self):
# do what ever login like in your case send an invitation
...
...
# don't forget to add translation support to your message _()
message_id = self.env['message.wizard'].create({'message': _("Invitation is successfully sent")})
return {
'name': _('Successfull'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'message.wizard',
# pass the id
'res_id': message_id.id,
'target': 'new'
}
The form view of message wizard is as simple as this:
<record id="message_wizard_form" model="ir.ui.view">
<field name="name">message.wizard.form</field>
<field name="model">message.wizard</field>
<field name="arch" type="xml">
<form >
<p class="text-center">
<field name="message"/>
</p>
<footer>
<button name="action_ok" string="Ok" type="object" default_focus="1" class="oe_highlight"/>
</footer>
<form>
</field>
</record>
Wizard is just simple is this:
class MessageWizard(model.TransientModel):
_name = 'message.wizard'
message = fields.Text('Message', required=True)
@api.multi
def action_ok(self):
""" close wizard"""
return {'type': 'ir.actions.act_window_close'}
Note: Never use exceptions to show Info message because everything run inside a big transaction when you click on button and if
there is any exception raised a Odoo will do rollback in the database, and you will lose your data if you don't commit your job first manually before that, witch is not recommended too in Odoo