0

当我尝试将 office365 中的约会加载到 Odoo 时,我遇到了完全相同的问题。反过来也没有问题……我对它进行了一些研究,发现 Python 期待以下内容:datetime.strptime(datetime_str, 'format')。格式取决于您获取数据的格式。在此站点https://www.journaldev.com/23365/python-string-to-datetime-strptime上,解释了 python 如何期望该格式。

每当我尝试在 Zapier 中添加格式时,这对错误没有任何结果,所以我认为这必须在其他地方完成。

其他人是否能够使用它?您在 Office365 部分中使用的日期格式是什么?或者你是如何克服这个问题的?这是否在 Odoo 版本 13 中发生了变化,是否会导致问题?

我无法编辑 Zapier 代码,因为这一切都在后台。我似乎唯一能做的就是改变日期格式,或者在 Zapier 中添加一些额外的参数。

欢迎所有帮助。

特此完整的错误消息:

We had trouble sending your test through.
Fault (code object of type 'DateTime' has no len()) occurred. Message: Traceback (most recent call last):
Hide details
Troubleshooting Errors | Common Odoo ERP Self Hosted Problems | Contact Support
  File "/usr/lib/python3/dist-packages/odoo/addons/base/controllers/rpc.py", line 54, in xmlrpc_1
    response = self._xmlrpc(service)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/controllers/rpc.py", line 43, in _xmlrpc
    result = dispatch_rpc(service, method, params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 138, in dispatch_rpc
    result = dispatch(method, params)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 40, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 93, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 175, in execute
    res = execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 164, in execute_cr
    return odoo.api.call_kw(recs, method, args, kw)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 393, in call_kw
    result = _call_kw_model_create(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 373, in _call_kw_model_create
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-148>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 322, in _model_create_single
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/addons/crm/models/calendar.py", line 50, in create
    event = super(CalendarEvent, self).create(vals)
  File "<decorator-gen-116>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 322, in _model_create_single
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/addons/calendar/models/calendar.py", line 1581, in create
    values['duration'] = self._get_duration(values['start'], values['stop'])
  File "/usr/lib/python3/dist-packages/odoo/addons/calendar/models/calendar.py", line 748, in _get_duration
    diff = fields.Datetime.from_string(stop) - fields.Datetime.from_string(start)
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1790, in to_datetime
    return datetime.strptime(value, DATETIME_FORMAT[:len(value)-2])
TypeError: object of type 'DateTime' has no len()
4

1 回答 1

0

DateTime方法不返回.len()属性,因此调用此类将导致错误。解决方案是设置DateTime一个变量,然后调用该变量的长度。

于 2020-02-25T15:57:38.880 回答