Editable datetime field in list/tree view

For a module, I have tried displaying datetime field in tree as follows:

<field name="date_time_journey" widget="date"/>
<field name="date_time_journey" widget="time"/>

I am able to render the list view, but I am unable to save, with the following error being displayed

ValueError: invalid type '<class 'datetime.date'>' for <class 'trytond.model.fields.date.DateTime'>

Please suggest a way to save successfully

Please provide the full traceback.

Traceback (most recent call last):
File "/trytond-5.0.15-py3.6.egg/trytond/wsgi.py", line 73, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond-5.0.15-py3.6.egg/trytond/protocols/dispatcher.py", line 46, in rpc
request, database_name, *request.rpc_params)
File "/trytond-5.0.15-py3.6.egg/trytond/wsgi.py", line 44, in auth_required
return wrapped(*args, **kwargs)
File "/trytond-5.0.15-py3.6.egg/trytond/protocols/wrappers.py", line 122, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond-5.0.15-py3.6.egg/trytond/protocols/dispatcher.py", line 176, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 147, in wrapper
return func(cls, *args, **kwargs)
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 994, in write
field.set(cls, fname, *fargs)
File "/trytond-5.0.15-py3.6.egg/trytond/model/fields/one2many.py", line 245, in set
Target.write(*to_write)
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 147, in wrapper
return func(cls, *args, **kwargs)
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 994, in write
field.set(cls, fname, *fargs)
File "/trytond-5.0.15-py3.6.egg/trytond/model/fields/one2many.py", line 247, in set
Target.create(to_create)
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 147, in wrapper
return func(cls, *args, **kwargs)
File "/trytond-5.0.15-py3.6.egg/trytond/model/modelsql.py", line 587, in create
insert_values.append(field.sql_format(value))
File "/trytond-5.0.15-py3.6.egg/trytond/model/fields/date.py", line 87, in sql_format
% (type(value), type(self)))
ValueError: invalid type '<class 'datetime.date'>' for <class 'trytond.model.fields.date.DateTime'>

I can not reproduce. Which version of the client are you using?

I am currently testing this on SAO

This does not tell us which version.

My SAO is currently version 5.0

It is still not a full version number. It must contain 3 numbers.

My SAO version is 5.0.8

Try first with the latest of the 5.0 series (now it is 5.0.17).

1 Like

Working perfectly with 5.0.17. Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.