Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when Referencing Sub Report in KPI Expression #640

Open
bamtech opened this issue Oct 9, 2024 · 0 comments
Open

Error when Referencing Sub Report in KPI Expression #640

bamtech opened this issue Oct 9, 2024 · 0 comments
Labels

Comments

@bamtech
Copy link

bamtech commented Oct 9, 2024

Hi,

I get an error when I reference a sub report from a kpi epression.

The module is mis-builder on v17 CE.

When generating a preview I get a "TypeError: type SimpleArray_1 doesn't define round method" when I reference a sub report from one of the lines of kpi epression. Here's the trace.

Traceback (most recent call last):
  File "/odoo17/odoo17-server/odoo/http.py", line 1783, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/odoo17/odoo17-server/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/odoo17/odoo17-server/odoo/http.py", line 1810, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/odoo17/odoo17-server/odoo/http.py", line 2014, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/odoo17/odoo17-server/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/odoo17/odoo17-server/odoo/http.py", line 759, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/odoo17/odoo17-server/addons/web/controllers/dataset.py", line 24, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/odoo17/odoo17-server/addons/web/controllers/dataset.py", line 20, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo17/odoo17-server/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/odoo17/odoo17-server/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_instance.py", line 876, in compute
    kpi_matrix = self._compute_matrix()
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_instance.py", line 869, in _compute_matrix
    self._add_column(aep, kpi_matrix, period, period.name, description)
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_instance.py", line 832, in _add_column
    return self._add_column_move_lines(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_instance.py", line 801, in _add_column_move_lines
    self.report_id._declare_and_compute_period(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report.py", line 896, in _declare_and_compute_period
    self._declare_and_compute_col(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report.py", line 753, in _declare_and_compute_col
    kpi_matrix.set_values(kpi, col_key, vals, drilldown_args)
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/kpimatrix.py", line 213, in set_values
    self.set_values_detail_account(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/kpimatrix.py", line 244, in set_values_detail_account
    val_rendered = self._style_model.render(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_style.py", line 159, in render
    return self.render_num(
  File "/odoo17/custom/addons/v17-custom-modules/mis_builder/models/mis_report_style.py", line 180, in render_num
    value = round(value / float(divider or 1), dp or 0) or 0
TypeError: type SimpleArray_1 doesn't define __round__ method

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://37.60.247.107:8017/web/assets/db80a43/web.assets_web.min.js:2888:163)
        at XMLHttpRequest.<anonymous> (http://37.60.247.107:8017/web/assets/db80a43/web.assets_web.min.js:2892:13)

Steps to reproduce the behavior:

  1. Add sub kpis to a report template.
  2. Reference the sub report from the kpi expressions.
  3. Generate a preview.

This works in previous versions so I'm guessing this is unique to v17.

@bamtech bamtech added the bug label Oct 9, 2024
@bamtech bamtech changed the title Error when Combining Sub Kpis and Sub Reports Error when Referencing Sub Reports in KPI Expression Oct 9, 2024
@bamtech bamtech changed the title Error when Referencing Sub Reports in KPI Expression Error when Referencing Sub Report in KPI Expression Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant