Hello
I'm trying to write a function that can compare the current date with one stored in the table to see if the current date is greater than the stored one .
i have tried every possible way to do that but i ended up with nothing !!!
the code just do nothing at the if statement . no error , no nothing at all.
Here is my code:
date_eval = datetime.now()
date_eval_str = date_eval.strftime('%Y-%m-%d')
warranty_records = self.env['warranty.details'].search([])
for val in warranty_records:
new_date = str(val.warranty_end_date)
print(new_date)
print(date_eval_str)
if new_date <= date_eval_str:
print("test")
print(val.state)
val.state = 'expired'
i hope anyone can have any clue on what may cause this problem.
Thanks