Tryton - Issues

 

Issue9500

Title crash general ledger report when move line has reference but without object.
Priority bug Status chatting
Superseder Nosy List ced, lukio
Type crash Components account
Assigned To Keywords
Reviews

Created on 2020-07-24.14:28:41 by lukio, last changed by ced.

Files
File name Uploaded Type Edit Remove
ksnip_20200724-093148.png lukio, 2020-07-24.14:35:06 image/png
Messages
msg59472 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2020-07-24.15:38:30
It happens since rev b8d76b07910f so the test added in rev 7a2b91535911 does not work anymore.
I think the solution would be to test if origin is an instance of Record.
msg59470 (view) Author: [hidden] (lukio) Date: 2020-07-24.14:28:40
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 "<string>", line 558, in <Expression "__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"
History
Date User Action Args
2020-07-24 15:38:30cedsetstatus: unread -> chatting
nosy: + ced
messages: + msg59472
2020-07-24 14:35:06lukiosetfiles: + ksnip_20200724-093148.png
2020-07-24 14:34:34lukiosetfiles: - 2020-07-24-092644_1366x768_scrot.png
2020-07-24 14:28:41lukiocreate

Showing 10 items. Show all history (warning: this could be VERY long)