Skip to Content
Menu
This question has been flagged
3 Replies
6497 Views

i have field start date & end date, and i want end date can't be filled less then start date , and  there will be warning if end date filled < start date

how, should i code method...thanks before

Avatar
Discard
Best Answer

Hi Susi,

You can add sql constraint for this as follows:-

_sql_constraints = [
        ('date_check', "CHECK ( (start_date <= end_date))", "The start date must be anterior to the end date.")
    ]

This will check the condition and if condition fails it will show the given message.

Hope this helps.

Avatar
Discard
Best Answer

Hi

this link can help for youe question :

https://www.odoo.com/forum/help-1/question/how-to-validate-star-date-is-less-than-the-current-date-or-not-50921#answer-50926

Avatar
Discard
Author Best Answer

its work thank u

Avatar
Discard