Error using account.move.send.wizard : KeyError: 'is_refund'
还没有人认领这个 Issue。
评估
调研方向
从第 196 行附近的 account.report_invoice_document 视图开始,跟踪从 account_move_send_wizard.action_send_and_print 传递的付款值。复现退款 PDF 和 Peppol 的生成,然后验证对于退款付款和非退款付款,报告均能在不出现 KeyError 的情况下进行渲染。
由索引模型根据 Issue 内容生成。
描述
Using Odoo 18 in a docker environment, i got an issue when trying to execute a refund (Extourner in french not sure in English) that neither generating the PDF or a Peppol would work and ended up with this exception :
Erreur de serveur Odoo
RPC_ERROR
Odoo Server Error
Occured on odoo.xxx.xxx on model account.move.send.wizard on 2025-07-24 16:03:46 GMT
Traceback (most recent call last):
File "<717>", line 2565, in template_717
File "<717>", line 2547, in template_717_content
File "<717>", line 1719, in template_717_t_call_0
KeyError: 'is_refund'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2123, in _transactioning
return service_model.retrying(func, env=self.env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 156, in retrying
result = func()
^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2090, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2338, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
result = endpoint(**request.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 754, in route_wrapper
result = endpoint(self, *args, **params_ok)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/dataset.py", line 42, in call_button
action = call_kw(request.env[model], method, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/api.py", line 533, in call_kw
result = getattr(recs, name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account_peppol/wizard/account_move_send_wizard.py", line 59, in action_send_and_print
return super().action_send_and_print(allow_fallback_pdf=allow_fallback_pdf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account/wizard/account_move_send_wizard.py", line 294, in action_send_and_print
attachments = self._generate_and_send_invoices(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account_move_send.py", line 716, in _generate_and_send_invoices
self._generate_invoice_documents(moves_data, allow_fallback_pdf=allow_fallback_pdf)
File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account_move_send.py", line 641, in _generate_invoice_documents
self._prepare_invoice_pdf_report(batch)
File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account_move_send.py", line 354, in _prepare_invoice_pdf_report
content, report_type = self.env['ir.actions.report'].with_company(company_id)._pre_render_qweb_pdf(pdf_report.report_name, res_ids=ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account/models/ir_actions_report.py", line 75, in _pre_render_qweb_pdf
return super()._pre_render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 1003, in _pre_render_qweb_pdf
return self._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids), 'pdf'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/sale_pdf_quote_builder/models/ir_actions_report.py", line 17, in _render_qweb_pdf_prepare_streams
result = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account_edi_ubl_cii/models/ir_actions_report.py", line 11, in _render_qweb_pdf_prepare_streams
collected_streams = super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/account/models/ir_actions_report.py", line 22, in _render_qweb_pdf_prepare_streams
return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 853, 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 "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 1091, in _render_qweb_html
return self._render_template(report.report_name, data), 'html'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 769, in _render_template
return view_obj._render_template(template, values).encode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 2199, in _render_template
return self.env['ir.qweb']._render(template, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/tools/profiler.py", line 313, in _tracked_method_render
return method_render(self, template, values, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 606, in _render
result = ''.join(rendering)
^^^^^^^^^^^^^^^^^^
File "<723>", line 38, in template_723
File "<723>", line 27, in template_723_content
File "<722>", line 86, in template_722
File "<722>", line 68, in template_722_content
File "<722>", line 56, in template_722_t_call_0
File "<717>", line 2573, in template_717
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'is_refund'
Template: account.report_invoice_document
Path: /t/t/div[2]/div/div[4]/div[1]/div[1]/div/table/t[2]/t/t[2]/tr/td[1]/i/t[1]
Node: <t t-if="payment_vals[\'is_refund\']"/>
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPCError@https://odoo.xxx.xxx/web/assets/74fbd7f/web.assets_web.min.js:3145:338
makeErrorFromResponse@https://odoo.xxx.xxx/web/assets/74fbd7f/web.assets_web.min.js:3148:163
rpc._rpc/promise</<@https://odoo.xxx.xxx/web/assets/74fbd7f/web.assets_web.min.js:3153:34
`
I fixed the issue modifying in the view "report_invoice_document" the line 196 the following
<t t-if="payment_vals['is_refund']">Reversed on </t>
by
<t t-if="payment_vals.get('is_refund', False)">Reversed on </t>
and it resolved my problem.
Of course this is a temporary fix, with the help from Claude as i am not a developer :-) and i know this file would be overwritten once an update will be deploy, so i am posting the issue in the hope this next version would come with a tested and properly done fix.
- 主要语言
- Dockerfile
- 星标
- 1.2k
- 派生
- 1.7k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
odoo/docker 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 70/100
-
Missing PyJWT ?未关闭
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 3/5 1-2 天 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 48/100
相似的 Issue
-
bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 78/100
LucasSantana-Dev/Lucky#3149 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
gke-labs/kube-agents#6615 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#34719 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 5 天内回复
-
good first issue help wanted javascript
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复