Skip to Content
Menu
This question has been flagged
2 Replies
8117 Views

Hi,

I encountering this error , and it has caused a 500 error. I don't understand what happened, I was installing a custom module which turned out to have a python error but after removing it. A different module started acting up.

File "/home/viscar/odoo12/odoo/tools/pycompat.py", line 86, inertial
raise value.with_traceback (tb)
File "/home/viscar/odoo12/odoo/tools/safe_eval.py", line 350 , in safe_eval
return unsafe_eval (c, globals_dict, locals_dict)
File "", line 1, in <module>
File "/home/viscar/odoo12-custom-addons/hr_reminder/models/hr_reminder.py", line 56, in reminder_scheduler
if i.expiry_date and datetime.strptime (today, "% Y-% m-% d") == datetime.strptime (i.expiry_date, "% Y-% m-% d"):
ValueError: <class' TypeError '>:' strptime () argument 1 must be str, not datetime.date 'while evaluating
' model.reminder_scheduler () '
2019-08-12 04: 50: 17,904 17244 INFO viscar werkzeug: 167.99.32.44 - - [12 / Aug / 2019 04:50:17] "POST / longpolling / poll HTTP / 1.1" 200 - 9 0.005 50.016
2019-08 -12 04: 50: 31,298 17244 INFO viscar odoo.addons.base.models.ir_cron: Starting job `Reminder scheduler`.
2019-08-12 04: 50: 31,318 17244 ERROR viscar odoo.addons.base.models.ir_cron: Call from cron Reminder scheduler for server action # 228 failed in Job # 13
Traceback (most recent call last):
File "/ home /viscar/odoo12/odoo/tools/safe_eval.py ", line 350, in safe_eval
return unsafe_eval (c, globals_dict, locals_dict)
File" ", line 1, in <module>
File" / home / viscar / odoo12-custom- addons / hr_reminder / models / hr_reminder.py ", line 56, in reminder_scheduler
if i.expiry_date and datetime.strptime (today, "% Y-% m-% d") == datetime.strptime (i.expiry_date, "% Y-% m-% d"):
TypeError: strptime () argument 1 must be str, not datetime.date

During handling of the above exception, another exception occurred:

Avatar
Discard

It seems the error is from hr_reminder custom module. Please post the code so that we can find the cause.

Best Answer

In your code datetime.strptime (today, "% Y-% m-% d") is causing the issue.  strptime accept string type date format to convert it to datime object, but it's getting parameter as datetime type not str type.


Avatar
Discard
Related Posts Replies Views Activity
2
Dec 23
12010
0
Oct 23
33
3
Oct 23
787
1
Oct 23
569
1
Aug 23
982