top of page
  • Writer's pictureTek Siong, Hock

How to Display Odoo Error Message and Alert Message

Updated: Aug 31, 2021

There are different ways to display error/validation message or user message.

1. ValidationError

This is the simplest for to display Exception or Validation Error.

from odoo import exceptions

raise exceptions.ValidationError('Please Save Quotation')

2. Message Alert

This is less intrusive way to give Reminder or Alert Message.

message = 'Click Save to refresh the Cost & Profit!'
warning_mess = {'title': ('Refresh'), 'message': message}

return {'warning': warning_mess}

3. Alert Pop Up

Similar to Message Alert. You can find the sample in the account module that using a field to control it.

<div groups="account.group_account_invoice" class="alert alert-info" role="alert" style="margin-bottom:0px;" attrs="{'invisible': [('has_outstanding','=',False)]}">
    You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding debits</a></bold> for this supplier. You can allocate them to mark this bill as paid.

Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.

931 views0 comments

Recent Posts

See All
bottom of page