invalid (?) entry in timesheet_work causes gtk client to show traceback
Trytond 5.0.2
timesheet-5.0.0
I somehow (UI or lag maybe?) managed to get these 2 entries in timesheet_work:
id | name | write_date | create_date | company | timesheet_end_date | origin | timesheet_start_date | write_uid | active | create_uid
----+------+------------+----------------------------+---------+--------------------+--------------------+----------------------+-----------+--------+------------
1 | IT | | 2018-12-27 13:29:21.411028 | 1 | | production.work,-1 | | | t | 1
2 | IT | | 2018-12-27 13:29:48.623976 | 1 | | | | | t | 1
This causes the client to show a error & traceback . I don't have it anymore right now, but in the tryton log was this:
Traceback (most recent call last):
File "/usr/lib64/python3.5/site-packages/trytond/protocols/dispatcher.py", line 176, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/usr/lib64/python3.5/site-packages/trytond/model/modelsql.py", line 826, in read
getter_results = field.get(ids, cls, field_list, values=result)
File "/usr/lib64/python3.5/site-packages/trytond/model/fields/function.py", line 103, in get
return dict((name, call(name)) for name in names)
File "/usr/lib64/python3.5/site-packages/trytond/model/fields/function.py", line 103, in <genexpr>
return dict((name, call(name)) for name in names)
File "/usr/lib64/python3.5/site-packages/trytond/model/fields/function.py", line 98, in call
return dict((r.id, method(r, name)) for r in records)
File "/usr/lib64/python3.5/site-packages/trytond/model/fields/function.py", line 98, in <genexpr>
return dict((r.id, method(r, name)) for r in records)
File "/usr/lib64/python3.5/site-packages/trytond/modules/timesheet/work.py", line 177, in get_rec_name
return self.origin.rec_name
AttributeError: 'str' object has no attribute 'rec_name'
I don't know much about the timesheet module (yet) but it seems the data that was in the timesheet_work row id 1 caused it to have an error. removing that row fixed my issue.