Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to display an error dialog after raising ValidationError

Simon Lee
on 8/11/16, 1:11 AM 138 views

I am using odoo 9. I added a field "serial_no" to the purchase_order_line model. When the user make changes to the serial_no, before saving, I would like to check if the serial_no is valid. If not, it will display an error message in a dialog box and prevent the record from saving.

My code is as followed:


def _check_serial_no(self):

    raise ValidationError('Serial no is not valid')

The above code is executed when openerp tried to save the record and did raise the ValidationError. But the error dialog is not displayed. Please advise how I can display the dialog box??? Do I need to change something on the settings? If yes, please advise what I need to set? Thanks.

Simon Lee

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 8/11/16, 1:11 AM
Seen: 138 times
Last updated: 8/11/16, 9:20 AM