Tryton - Issues



Title KeyError: 'payment' when trying to print imported statement
Priority bug Status chatting
Superseder Nosy List ced, risto3
Type crash Components account_payment_clearing, account_statement
Assigned To Keywords

Created on 2019-08-24.23:02:17 by risto3, last changed by ced.

msg51463 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-25.08:58:59
It is because _get_grouped_line call _group_key with origins or lines. But account_payment_clearing tries to group per payment which is only available on lines. I guess this extra key should be added only for lines.
msg51462 (view) Author: [hidden] (risto3) Date: 2019-08-24.23:02:16
When testing a statement import module (using account_statement_aeb43 as template)
I can add the lines needed to complete the statement, but I get the following when trying to print:

ERROR:tryton.common.common:Traceback (most recent call last):
  File "/trytond/model/", line 1385, in __getattr__
    field = self._fields[name]
KeyError: 'payment'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/trytond/", line 104, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/", line 72, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/report/", line 182, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/report/", line 190, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/", line 290, in render
    data = rel_report(**report_context).render()
  File "/site-packages/relatorio/templates/", line 35, in render, method=method, encoding=encoding, out=out)
  File "/site-packages/relatorio/templates/", line 1161, in __call__
    self.xml_serializer(writer(stream)), encoding=encoding, out=writer)
  File "/site-packages/genshi/", line 58, in encode
    for chunk in iterator:
  File "/site-packages/genshi/", line 241, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/", line 671, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/", line 776, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/site-packages/genshi/", line 596, in __call__
    for ev in stream:
  File "/site-packages/relatorio/templates/", line 1053, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/", line 292, in _ensure
    for event in stream:
  File "/site-packages/genshi/filters/", line 691, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/template/", line 638, in _include
    for event in stream:
  File "/site-packages/genshi/template/", line 327, in _match
    for event in stream:
  File "/site-packages/genshi/template/", line 578, in _flatten
    for kind, data, pos in stream:
  File "/site-packages/genshi/template/", line 374, in __call__
    for item in iterable:
  File "/trytond/modules/account_statement/", line 408, in grouped_lines
    Line = self._get_grouped_line()
  File "/trytond/modules/account_statement/", line 383, in _get_grouped_line
    keys = [k[0] for k in self._group_key(lines[0])]
  File "/trytond/modules/account_payment_clearing/", line 62, in _group_key
    return key + (('payment', line.payment),)
  File "/trytond/model/", line 1387, in __getattr__
    raise AttributeError('"%s" has no attribute "%s"' % (self, name))
AttributeError: "account.statement.origin,31" has no attribute "payment"

Fault: "account.statement.origin,31" has no attribute "payment"

I don't get this error when printing statements manually entered (and not imported).

Any hints on figuring out how to resolve this?

That is, why does account_payment_clearing have issues?

BTW, I'm on latest 5.2.
Date User Action Args
2019-08-25 08:59:07cedsettype: crash
2019-08-25 08:59:00cedsetstatus: unread -> chatting
nosy: + ced
messages: + msg51463
2019-08-24 23:02:17risto3create

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