I am new to python and not sure how to fix this error. Please guide me. I want to have validation for the date field where if the date field has past date which is lesser than the current date then it should give an error message and shouldn't save the value despite I click the 'Save' button.
I get the error like I mentioned in the title.
Here's the code
from odoo import api, fields, models
from odoo.exceptions import ValidationError
from datetime import datetime
now = datetime.now()
curdat = now.strftime("%x")
@api.multi
@api.constrains('date', 'curdat')
def date_constrains(self):
if self.date < self.curdat:
raise ValidationError('Date must be today date or greater than today date...')