Odoo 12 Can't Start Custom Module - Typeerror: Unsupported Operand Type(s) For -: 'tuple' And 'datetime.timedelta'
iam new to odoo what iam trying to do is , i want to minus datetime.timedelta(days = 90) that is 90 days from the license_renewal_date = (2021,6,6) how to do it , but when i try ia
Solution 1:
You can't create object datetime
using only tuple (2021,6,6)
license_renewal_date = (2021,6,6)
You have to use object datetime
for this
license_renewal_date = datetime.datetime(2021, 6, 6).date()
And this is all your problem.
Now it works without error:
import datetime
before_90_days = datetime.datetime.now().date() - datetime.timedelta(days=90)
print(before_90_days)
license_renewal_date = datetime.datetime(2021, 6, 6).date()
exp_90_days = license_renewal_date - datetime.timedelta(days=90)
print(exp_90_days)
Post a Comment for "Odoo 12 Can't Start Custom Module - Typeerror: Unsupported Operand Type(s) For -: 'tuple' And 'datetime.timedelta'"