Hello,
I am new to odoo
@api.model
def test_cron_job(self):
print("abcddddddddddddddddddddddddddddddddddddddddddd")
today = fields.Date.today()
custom_date = self.env['hr.holidays'].search([('custom_date_from', '>=', today)])
print("custom_date", custom_date)
for rec in custom_date:
if rec.custom_date_from - today == 7:
mail = self.env['mail.template'].search(['hr_holidays.leave_email_template'])
mail.send()
else:
if rec.custom_date_from - today == 1:
mail = self.env['mail.template'].search([('hr_holidays.leave_request_email_template')])
mail.send()
I am getting this error
Traceback (most recent call last): File "/opt/odoo/odoo11/odoo/tools/safe_eval.py", line 351, in safe_eval return unsafe_eval(c, globals_dict, locals_dict) File "", line 1, in File "/opt/odoo/sintranet-SintraNet_Prod/half_day_leave/models/custom_hr_holidays.py", line 54, in test_cron_job if rec.custom_date_from - today == 7: TypeError: unsupported operand type(s) for -: 'str' and 'str'How to solve this please help me