← Back to Pull requests

[16.0][FIX] account_financial_report: KeyError rendering report #1260

Closed
unknown closed this pull request without merging on Dec 03, 2024 11:48 UTC
View on GitHub
unknown unknown commented on Dec 03, 2024 10:14 UTC
Author

Some reports were failing to render without this fix.

It seems there was a regression introduced in 0a2b2736cdc1a73d6248b91fa79a0f4c6aedc99b.

!image

<details>

Traceback (most recent call last):
  File "<1582>", line 352, in template_1582
  File "<1582>", line 197, in template_1582_content
KeyError: 'fin_bal_currency_id'

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

Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/[http.py](https://http.py/)", line 1653, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/custom/src/odoo/odoo/service/[model.py](https://model.py/)", line 133, in retrying
    result = func()
  File "/opt/odoo/custom/src/odoo/odoo/[http.py](https://http.py/)", line 1680, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/custom/src/odoo/odoo/[http.py](https://http.py/)", line 1794, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/[ir_http.py](https://ir_http.py/)", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/custom/src/odoo/odoo/[http.py](https://http.py/)", line 734, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/auto/addons/report_xlsx/controllers/[main.py](https://main.py/)", line 49, in report_routes
    return super().report_routes(reportname, docids, converter, **data)
  File "/opt/odoo/custom/src/odoo/odoo/[http.py](https://http.py/)", line 734, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/auto/addons/web/controllers/[report.py](https://report.py/)", line 39, in report_routes
    html = report.with_context(context)._render_qweb_html(reportname, docids, data=data)[0]
  File "/opt/odoo/auto/addons/account_financial_report/models/[ir_actions_report.py](https://ir_actions_report.py/)", line 19, in _render_qweb_html
    return super(IrActionsReport, obj)._render_qweb_html(
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/[ir_actions_report.py](https://ir_actions_report.py/)", line 971, in _render_qweb_html
    return self._render_template(report.report_name, data), 'html'
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/[ir_actions_report.py](https://ir_actions_report.py/)", line 651, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/[ir_ui_view.py](https://ir_ui_view.py/)", line 2129, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/opt/odoo/custom/src/odoo/odoo/tools/[profiler.py](https://profiler.py/)", line 294, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/[ir_qweb.py](https://ir_qweb.py/)", line 587, in _render
    result = ''.join(rendering)
  File "<1578>", line 92, in template_1578
  File "<1578>", line 74, in template_1578_content
  File "<1578>", line 56, in template_1578_t_call_0
  File "<1578>", line 21, in template_1578_t_call_1
  File "<1579>", line 326, in template_1579
  File "<1579>", line 216, in template_1579_content
  File "<1582>", line 358, in template_1582
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'fin_bal_currency_id'
Template: account_financial_report.report_general_ledger_ending_cumul
Path: /t/div/div/t[8]/t[1]/t
Node: <t t-set="account_currency" t-value="currency_model.browse(account[\'fin_bal_currency_id\'])"/>

</details>

@moduon MT-8285

Diff: 477 lines (+357 / -120) across 5 files Reviewer: loida-vm Review duration: 93m
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 477 lines diff across 5 files
0.46
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.369
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1260"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 45.8% (MEDIUM) · Higher = larger blast radius
45.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 18.1% · Safe to merge
18.1%