跳至内容
菜单
此问题已终结
1 回复
2496 查看

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"

形象
丢弃
最佳答案

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

形象
丢弃