Skip to main content

How to Open Success Message Popup in Odoo

Odoo doesn’t offer a unified way for developers to show a popup with custom messages and buttons. That’s why we need a workaround.

In this blog post, we are going to show you how to open the Success Message Popup in Odoo. The Success Message Popup is a popup that appears after you have successfully completed action in Odoo. This popup can be customized to include information such as the success message, the user name, and the date and time of the action.

Create A TransientModel To Store Message

TransientModel is an abstract model that allows you to create temporary objects in Odoo. TransientModels are used to represent non-persistent data in Odoo, such as user input, intermediate results, and so on.

This is what we need for the popup. We store a message as temporary data and show it when it is neded. These messages will be deleted by a vacuum job periodically.

class MyModuleMessageWizard(models.TransientModel):
    _name = 'mymodule.message.wizard'
    _description = "Message Popup"

    message = fields.Text('Message', required=True)

    def action_close(self):
        return {'type': 'ir.actions.act_window_close'}
<record id="mymodule_message_wizard_form" model="ir.ui.view">
    <field name="name">mymodule.message.wizard.form</field>
    <field name="model">mymodule.message.wizard</field>
    <field name="arch" type="xml">
            <field name="message" readonly="True"/>
                <button name="action_close" string="Ok" type="object" default_focus="1" class="oe_highlight"/>

Call The Popup

def mymodule_open_popup(self):
    mymodule = self.get_server_info(
    message_id = self.env['mymodule.message.wizard'].create({'message': 'Your data was upadted successfully!'})
    return {
        'name': 'Message',
        'type': 'ir.actions.act_window',
        'view_mode': 'form',
        'res_model': 'mymodule.message.wizard',
        'target': 'new'

By continuing to use the site, you agree to the use of cookies.