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

can anyone please tell mew how can i put a warning message in the odoo front end when soemone enter the wrong detail

am editing the leave form for my requrements, there is a type of leave that is allowed only for saudi citizens and not for other citizens, if the non saudi citizen enter the country, the warnign message should popup "This leave is allowed only for saudi citizens"

Avatar
Discard
Best Answer

Hi,

You can do it using the constrains, see the example,

from odoo import models, fields, api, exceptions
@api.constrains('field_name')
def check_leave_type(self):
if give the condition:
raise exceptions.Warning('This leave is allowed only for saudi citizens')

See this: How To Add Constrains For A Field in Odoo

Thanks

Avatar
Discard