Best answer

Odoo ERP Self-Hosted, DateTime format issue - "code object of type 'DateTime' has no len()" error

  • 3 September 2021
  • 2 replies
  • 243 views

When trying to connect to an odoo database to create a calendar event, Zapier throws an error:

File "/home/odoo/addons/odoo/odoo/addons/base/controllers/rpc.py", line 60, in xmlrpc_1 response = self._xmlrpc(service) File "/home/odoo/addons/odoo/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc result = dispatch_rpc(service, method, params) File "/home/odoo/addons/odoo/odoo/http.py", line 139, in dispatch_rpc result = dispatch(method, params) File "/home/odoo/addons/odoo/odoo/service/model.py", line 41, in dispatch res = fn(db, uid, *params) File "/home/odoo/addons/odoo/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/addons/odoo/odoo/service/model.py", line 181, in execute res = execute_cr(cr, uid, obj, method, *args, **kw) File "/home/odoo/addons/odoo/odoo/service/model.py", line 165, in execute_cr result = odoo.api.call_kw(recs, method, args, kw) File "/home/odoo/addons/odoo/odoo/api.py", line 385, in call_kw result = _call_kw_model_create(method, model, args, kwargs) File "/home/odoo/addons/odoo/odoo/api.py", line 365, in _call_kw_model_create result = method(recs, *args, **kwargs) File "<decorator-gen-202>", line 2, in create File "/home/odoo/addons/odoo/odoo/api.py", line 314, in _model_create_single return create(self, arg) File "/home/odoo/addons/odoo/addons/crm/models/calendar.py", line 50, in create event = super(CalendarEvent, self).create(vals) File "<decorator-gen-123>", line 2, in create File "/home/odoo/addons/odoo/odoo/api.py", line 335, in _model_create_multi return create(self, [arg]) File "/home/odoo/addons/odoo/addons/calendar/models/calendar.py", line 1602, in create values['duration'] = self._get_duration(values['start'], values['stop']) File "/home/odoo/addons/odoo/addons/calendar/models/calendar.py", line 753, in _get_duration diff = fields.Datetime.from_string(stop) - fields.Datetime.from_string(start) File "/home/odoo/addons/odoo/odoo/fields.py", line 1821, in to_datetime return datetime.strptime(value, DATETIME_FORMAT[:len(value)-2]) TypeError: object of type 'DateTime' has no len()

 

Any suggestions how to get around this issue?

Odoo 13 Enterprise, self hosted.

 

Thanks!

icon

Best answer by SamB 6 September 2021, 13:18

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +11

Hey @pingu, welcome to the Community! :) 

I can see that you’ve also reached out to our Support team about this. They identified that the error was caused by a known issue with the Odoo ERP Self Hosted integration and added you to the list of affected users on the related bug report.

I don’t have an ETA on when it will be fixed but we’ll be in touch by email as soon as it’s resolved!

 

UPDATE 2022-09-14

One of our members has found a workaround using a patch, check out this post for details: 

 

 

Userlevel 7
Badge +12

Hi @pingu! I just wanted to draw your attention to this post as it describes a patch that solved the date issue for that member: