OCA / account-payment

Project supervised by the Banking PSC
https://odoo-community.org/psc-teams/banking-10
GNU Affero General Public License v3.0
89 stars 411 forks source link

[16.0] error when generating a report with a return payment #729

Open JorgeQuinteros opened 6 months ago

JorgeQuinteros commented 6 months ago

Module

account_payment_return

Describe the bug

I have run tests in runboat and have managed to reproduce this error. Apparently when you have the account_payment_return module installed, create a payment return and try to print a report you get the following error:

image

Traceback (most recent call last):
  File "<659>", line 2333, in template_659
  File "<659>", line 2315, in template_659_content
  File "<659>", line 1484, in template_659_t_call_0
KeyError: 'is_exchange'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 1638, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/odoo/http.py", line 1665, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo/http.py", line 1869, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo/http.py", line 700, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 42, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/models.py", line 6578, in onchange
    record._onchange_eval(name, field_onchange[name], result)
  File "/opt/odoo/odoo/models.py", line 6289, in _onchange_eval
    method_res = method(self)
  File "/opt/odoo/addons/account/wizard/account_invoice_send.py", line 95, in onchange_is_email
    self.composer_id._onchange_template_id_wrapper()
  File "/opt/odoo/addons/mail/wizard/mail_compose_message.py", line 177, in _onchange_template_id_wrapper
    values = self._onchange_template_id(self.template_id.id, self.composition_mode, self.model, self.res_id)['value']
  File "/opt/odoo/addons/mail/wizard/mail_compose_message.py", line 591, in _onchange_template_id
    values = self.generate_email_for_composer(
  File "/opt/odoo/addons/mail/wizard/mail_compose_message.py", line 721, in generate_email_for_composer
    template_values = self.env['mail.template'].with_context(tpl_partners_only=True).browse(template_id).generate_email(res_ids, fields)
  File "/opt/odoo/addons/account_edi/models/mail_template.py", line 39, in generate_email
    res = super().generate_email(res_ids, fields)
  File "/opt/odoo/addons/mail/models/mail_template.py", line 286, in generate_email
    result, report_format = self.env['ir.actions.report']._render_qweb_pdf(report, [res_id])
  File "/opt/odoo/addons/account/models/ir_actions_report.py", line 61, in _render_qweb_pdf
    return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 864, in _render_qweb_pdf
    collected_streams = self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/addons/account_edi_ubl_cii/models/ir_actions_report.py", line 58, in _render_qweb_pdf_prepare_streams
    collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/addons/account_edi/models/ir_actions_report.py", line 14, in _render_qweb_pdf_prepare_streams
    collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/addons/account/models/ir_actions_report.py", line 20, in _render_qweb_pdf_prepare_streams
    return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 715, in _render_qweb_pdf_prepare_streams
    html = self.with_context(**additional_context)._render_qweb_html(report_ref, all_res_ids_wo_stream, data=data)[0]
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 914, in _render_qweb_html
    return self._render_template(report.report_name, data), 'html'
  File "/opt/odoo/odoo/addons/base/models/ir_actions_report.py", line 624, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 2127, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/opt/odoo/odoo/tools/profiler.py", line 292, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/opt/odoo/odoo/addons/base/models/ir_qweb.py", line 581, in _render
    result = ''.join(rendering)
  File "<663>", line 90, in template_663
  File "<663>", line 72, in template_663_content
  File "<663>", line 60, in template_663_t_call_0
  File "<659>", line 2339, in template_659
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'is_exchange'
Template: account.report_invoice_document
Path: /t/t/div[2]/div/div[2]/div/div/table/t[3]/t/t[2]/tr
Node: <tr t-if="payment_vals[\'is_exchange\'] == 0"/>

The above server error caused the following client error:
null

To Reproduce

Affected versions: 16.0

Steps to reproduce the behavior:

  1. Create a regular sale invoice.
  2. Register the payment.
  3. Create a "Customer Payment return" of the regular invoice.
  4. Go to the invoice and try to print the invoice.

Expected behavior Generate the report without errors Additional context

github-actions[bot] commented 4 days ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.