Odoo Help

0

How to display an error dialog after raising ValidationError

By
Simon Lee
on 8/11/16, 1:11 AM 391 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:

@api.constrains('serial_no')

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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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