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

Account move line with multiple analytic distribution. #1264

Open
dainiervg1988 opened this issue Dec 18, 2024 · 6 comments
Open

Account move line with multiple analytic distribution. #1264

dainiervg1988 opened this issue Dec 18, 2024 · 6 comments

Comments

@dainiervg1988
Copy link

The referenced line raise an error when account move line have more than one analytic distribution.

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 1783, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/home/odoo/src/odoo/odoo/http.py", line 1810, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/src/odoo/odoo/http.py", line 1927, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
File "/home/odoo/src/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
response = super()._dispatch(endpoint)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 221, in _dispatch
result = endpoint(**request.params)
File "/home/odoo/src/odoo/odoo/http.py", line 757, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/home/odoo/src/user/report_xlsx/controllers/main.py", line 51, in report_routes
return super().report_routes(reportname, docids, converter, **data)
File "/home/odoo/src/odoo/odoo/http.py", line 757, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/home/odoo/src/odoo/addons/web/controllers/report.py", line 39, in report_routes
html = report.with_context(context)._render_qweb_html(reportname, docids, data=data)[0]
File "/home/odoo/src/user/account_financial_report/models/ir_actions_report.py", line 19, in _render_qweb_html
return super(IrActionsReport, obj)._render_qweb_html(
File "/home/odoo/src/enterprise/web_studio/models/ir_actions_report.py", line 24, in _render_qweb_html
return super(IrActionsReport, self)._render_qweb_html(report_ref, docids, data)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 985, in _render_qweb_html
data = self._get_rendering_context(report, docids, data)
File "/home/odoo/src/enterprise/web_studio/models/ir_actions_report.py", line 44, in _get_rendering_context
ctx = super()._get_rendering_context(report, docids, data)
File "/home/odoo/src/odoo/addons/stock/models/ir_actions_report.py", line 8, in _get_rendering_context
data = super()._get_rendering_context(report, docids, data)
File "/home/odoo/src/odoo/addons/account/models/ir_actions_report.py", line 77, in _get_rendering_context
data = super()._get_rendering_context(report, docids, data)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions_report.py", line 1000, in _get_rendering_context
data.update(report_model._get_report_values(docids, data=data))
File "/home/odoo/src/user/account_financial_report/report/general_ledger.py", line 803, in _get_report_values
) = self._get_period_ml_data(
File "/home/odoo/src/user/account_financial_report/report/general_ledger.py", line 474, in _get_period_ml_data
analytic_ids.add(int(analytic_account))
ValueError: invalid literal for int() with base 10: '4334,3947,3944'

@pedrobaeza
Copy link
Member

I think you don't have latest source code.

@dainiervg1988
Copy link
Author

@pedrobaeza you mean odoo source code? the referenced line in branch 17.0 remains the same.
when you access to analytic_distribution return the following {"4334,3947,3944": 100.0, "4334,3947,4103": 100.0, "4334,3947,4202": 100.0, "4334,3947,4273": 100.0}, the key have the ID joined by comma, and fail when try to convert integer.
ValueError: invalid literal for int() with base 10: '4334,3947,3944'

@pedrobaeza
Copy link
Member

Yes. There was this patch some time ago for something similar: #1219

@dainiervg1988
Copy link
Author

dainiervg1988 commented Dec 18, 2024

But in General Ledger report still wrong, right? This report use directly the field analytic_distribution, no analytic_account_ids

@pedrobaeza
Copy link
Member

I don't know. I just wanted to know if you have that patch applied.

@dainiervg1988
Copy link
Author

Yes, the patch is applied.
The fix is in computed field analytic_account_ids, I think this field must be used in General Leder report instead of analytic_distribution.

for analytic_account in move_line["analytic_distribution"] or {}:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants