Это следующий код в Odoo, и он работает не так, как я ожидал.
def _check_dates(self, cr, uid, ids, context=None):
for rec in self.browse(cr, uid, ids, context=context):
if rec.rdate and rec.gdate :
start = date.strftime(str(rec.rdate), "%Y-%m-%d")
end = date.strftime(str(rec.gdate), "%Y-%m-%d")
if start >= end:
return False
return True
_constraints = [
(_check_dates, 'Error ! Received Date must be less or equal than given Date', ['rdate'])
]
Пожалуйста, поправьте меня кто-нибудь. Спасибо