跳至內容
選單
此問題已被標幟
1 回覆
2544 瀏覽次數

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

頭像
捨棄