Search code examples
odoo-12

odoo12 how to show success message without break


everybody, please help in odoo, i know that the error message showing was use raise UserError(), but this function will break the function and rollback in database, what i want to do is just simplely show the successful message to user without break, like operation was successful!. of course, i have try to use the wizard, but the footer is not working, the page always show the save and discard appreciate if anybody can help me on this. thanks.


Solution

  • In that, you can use the onchange API to work around this,

    @api.onchange('my_field')
    def my_field_change(self):
        // warning message
        return {
            'warning': {'title': _('Error'), 'message': _('Error message'),},
         }
    

    With that, Perform the change with your case return the warning message and it does not break the process.You can find a similar behavior on Odoo Sale App on sale order line product change operation.

    Thanks