In Odoo 12 I am trying to get a mail 90 days prior (before) to expiry of subscription and automatically I have created a email template and function for this but iam not receiving any mails even though i create any records
In 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(self.id, force_send=True)