Skip to Content
Menu
This question has been flagged
1 Reply
1198 Views

how to handle unique field in odoo website.when submitting form getting internal server error due to unique field in custom view odoo v13?

Avatar
Discard
Best Answer

Hi, Akshay


In order to handle unique field error. You can add try except in your controller like below,

from psycopg2 import IntegrityError 
from odoo.exceptions import ValidationError

def yourMethod():
    try:
        #YourDefination
    exceptValidationError as e:
        print("Validation Error")
    exceptIntegrityError as e:
        print("Integrity Error")
Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Avatar
Discard