Tryton - Issues

 

Issue8606

Title KeyError: 'payment' when trying to print imported statement
Priority bug Status resolved
Superseder Nosy List ced, reviewbot, risto3, roundup-bot
Type crash Components account_payment_clearing
Assigned To ced Keywords review
Reviews 274001008
View: 274001008

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

Messages
New changeset 8e81d42e2b4b by Cédric Krier in branch '5.2':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/8e81d42e2b4b

New changeset 59a9b1276757 by Cédric Krier in branch '5.0':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/59a9b1276757

New changeset 6e6c227eef36 by Cédric Krier in branch '4.8':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/6e6c227eef36

New changeset 530f75442051 by Cédric Krier in branch '4.6':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/530f75442051

New changeset 74f01c6c31e8 by Cédric Krier in branch '4.4':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/74f01c6c31e8
New changeset 5bcf126a396e by Cédric Krier in branch 'default':
Group line per payment only if they have the attribute
https://hg.tryton.org/tryton-env/rev/5bcf126a396e
New changeset e33e9acd6b62 by Cédric Krier in branch 'default':
Group line per payment only if they have the attribute
https://hg.tryton.org/modules/account_payment_clearing/rev/e33e9acd6b62
msg51994 (view) Author: [hidden] (risto3) Date: 2019-09-21.13:50:44
seams to work for me. +1
review274001008 updated at https://codereview.tryton.org/274001008/#ps264231002
review274001008 updated at https://codereview.tryton.org/274001008/#ps254321002
msg51910 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-09-18.17:06:33
Here is review274001008 which should fix the issue.
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/modelstorage.py", 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/wsgi.py", line 104, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 72, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/report/report.py", line 182, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/report/report.py", line 190, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 290, in render
    data = rel_report(**report_context).render()
  File "/site-packages/relatorio/templates/base.py", line 35, in render
    self.events, method=method, encoding=encoding, out=out)
  File "/site-packages/relatorio/templates/opendocument.py", line 1161, in __call__
    self.xml_serializer(writer(stream)), encoding=encoding, out=writer)
  File "/site-packages/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/site-packages/genshi/output.py", line 241, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/output.py", line 671, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/output.py", line 776, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/site-packages/genshi/output.py", line 596, in __call__
    for ev in stream:
  File "/site-packages/relatorio/templates/opendocument.py", line 1053, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/core.py", line 292, in _ensure
    for event in stream:
  File "/site-packages/genshi/filters/i18n.py", line 691, in __call__
    for kind, data, pos in stream:
  File "/site-packages/genshi/template/base.py", line 638, in _include
    for event in stream:
  File "/site-packages/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/site-packages/genshi/template/base.py", line 578, in _flatten
    for kind, data, pos in stream:
  File "/site-packages/genshi/template/directives.py", line 374, in __call__
    for item in iterable:
  File "/trytond/modules/account_statement/statement.py", line 408, in grouped_lines
    Line = self._get_grouped_line()
  File "/trytond/modules/account_statement/statement.py", line 383, in _get_grouped_line
    keys = [k[0] for k in self._group_key(lines[0])]
  File "/trytond/modules/account_payment_clearing/statement.py", line 62, in _group_key
    return key + (('payment', line.payment),)
  File "/trytond/model/modelstorage.py", 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.
History
Date User Action Args
2019-10-23 00:51:17roundup-botsetmessages: + msg52626
keyword: - backport
2019-09-28 23:18:12cedsetkeyword: + backport
2019-09-28 23:17:50roundup-botsetmessages: + msg52073
2019-09-28 23:17:47roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg52072
2019-09-21 13:50:45risto3setmessages: + msg51994
2019-09-18 17:46:53reviewbotsetmessages: + msg51914
2019-09-18 17:12:20reviewbotsetnosy: + reviewbot
messages: + msg51912
2019-09-18 17:06:41cedsetcomponent: - account_statement
2019-09-18 17:06:33cedsetstatus: chatting -> testing
reviews: 274001008
messages: + msg51910
keyword: + review
assignedto: ced
2019-08-25 08:59:07cedsettype: crash

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