crash general ledger report when move line has reference but without object.
tested on demo v5.6 and demo v5.0
Reproduce:
1. Create a new account move.
2. Add move lines. One of them set the origin but without any object (added an screenshot).
3. Try to generate general ledger odt report and crash because origin id is set to -1.
Traceback (most recent call last):
File "/genshi/template/evalpy", line 318, in lookup_attr
val = getattr(obj, key)
AttributeError: 'str' object has no attribute 'id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/genshi/template/evalpy", line 324, in lookup_attr
val = obj[key]
TypeError: string indices must be integers
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 109, in dispatch_request
return endpoint(request, **requestview_args)
File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 48, in rpc
request, database_name, *requestrpc_params)
File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 77, in auth_required
return wrapped(*args, **kwargs)
File "/usr/local/lib/python37/dist-packages/trytond/protocols/wrapperspy", line 131, in wrapper
return func(request, pool, *args, **kwargs)
File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 181, in _dispatch
result = rpcresult(meth(*c_args, **c_kwargs))
File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 204, in execute
oext, content = cls_execute(records, data, action_report)
File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 212, in _execute
return clsconvert(action, clsrender(action, report_context))
File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 314, in render
data = rel_report(**report_context)render()
File "/usr/local/lib/python37/dist-packages/relatorio/templates/basepy", line 35, in render
selfevents, method=method, encoding=encoding, out=out)
File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 1169, in __call__
selfxml_serializer(writer(stream)), encoding=encoding, out=writer)
File "/genshi/outputpy", line 58, in encode
for chunk in iterator:
File "/genshi/outputpy", line 241, in __call__
for kind, data, pos in stream:
File "/genshi/outputpy", line 671, in __call__
for kind, data, pos in stream:
File "/genshi/outputpy", line 776, in __call__
for kind, data, pos in chain(stream, [(None, None, None)]):
File "/genshi/outputpy", line 596, in __call__
for ev in stream:
File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 1061, in __call__
for kind, data, pos in stream:
File "/genshi/corepy", line 292, in _ensure
for event in stream:
File "/genshi/filters/i18npy", line 691, in __call__
for kind, data, pos in stream:
File "/genshi/template/basepy", line 638, in _include
for event in stream:
File "/genshi/template/markuppy", line 327, in _match
for event in stream:
File "/genshi/template/basepy", line 598, in _flatten
result = _eval_expr(data, ctxt, vars)
File "/genshi/template/basepy", line 289, in _eval_expr
retval = exprevaluate(ctxt)
File "/genshi/template/evalpy", line 178, in evaluate
return eval(selfcode, _globals, {'__data__': data})
File "", line 558, in _relatorio_escape_invalid_chars(lineoriginrec_name if lineorigin and lineoriginid >= 0 else '')">
File "/genshi/template/evalpy", line 326, in lookup_attr
val = clsundefined(key, owner=obj)
File "/genshi/template/evalpy", line 414, in undefined
raise UndefinedError(key, owner=owner)
genshitemplateevalUndefinedError: 'accountmoveline,-1' has no member named "id"
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
ksnip_20200724-093148.png | @lukio | 2020-07-24 12:35:06.377000 UTC | image/png |