i want to minus datetime.timedelta (days = 90) that is 90 days from the license_renewal_date = (2021,6,6) how to do it
before_90_days = datetime.datetime.now (). date () - datetime.timedelta (days = 90) datetime.date (2020, 3, 11)
license_renewal_date = (2021,6,6)
exp_90_days = license_renewal_date - datetime.timedelta (days = 90)
Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type (s) for -: 'tuple' and 'datetime.timedelta'
in odoo: py file -license_renewal_date = fields.Date ("Renewal Date", track_visibility = 'onchange')
def exp_date1(self):
before_90_days = datetime.datetime.now().date()- datetime.timedelta(days = 90)
exp_90days = self.env['(crm.lead.extended)'].search([('(license_renewal_date)','=',before_90_days)])
template = self.env.ref('crm_extended.create_crm_lead_mail_template')
template.send_mail(rec.id, force_send=True)
Python Timedelta: http://learnopenerp.blogspot.com/2018/02/python-timedelta.html