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

[16.0][FIX] account_chart_update: fix _update_accounts when creating account #1959

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

AnizR
Copy link
Contributor

@AnizR AnizR commented Oct 29, 2024

After reading the source code, I realized that tax_template_ref should contain a dict of tax recordset and not just ids:

vals = self.chart_template_id._get_account_vals(
self.company_id,
template,
self.padded_code(template.code),
tax_template_ref,
)

definition of _get_account_vals in odoo:
https://github.com/odoo/odoo/blob/6afdb0f18c767e0006acd72b1f064f526fe330af/addons/account/models/chart_template.py#L957-L963

I had this error when trying to update a chart account:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/odoo/lib/python3.10/site-packages/odoo/http.py", line 1591, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/odoo/lib/python3.10/site-packages/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/odoo/lib/python3.10/site-packages/odoo/http.py", line 1618, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/odoo/lib/python3.10/site-packages/odoo/http.py", line 1822, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/website/models/ir_http.py", line 237, in _dispatch
    response = super()._dispatch(endpoint)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/extendable/models/ir_http.py", line 20, in _dispatch
    return super()._dispatch(endpoint)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
  File "/odoo/lib/python3.10/site-packages/odoo/http.py", line 697, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/web/controllers/dataset.py", line 46, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/lib/python3.10/site-packages/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/odoo/lib/python3.10/site-packages/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/odoo/lib/python3.10/site-packages/odoo/addons/account_chart_update/wizard/wizard_chart_update.py", line 421, in action_update_records
    self._update_accounts()
  File "/odoo/lib/python3.10/site-packages/odoo/addons/account_chart_update/wizard/wizard_chart_update.py", line 1167, in _update_accounts
    vals = self.chart_template_id._get_account_vals(
  File "/app/odoo/addons/ebt_account_template_legacy_code/models/account_chart_template.py", line 11, in _get_account_vals
    vals = super()._get_account_vals(
  File "/app/odoo/addons/ebt_account_template_deprecated/models/account_chart_template.py", line 11, in _get_account_vals
    vals = super()._get_account_vals(
  File "/app/odoo/addons/ebt_account_template_aggregated_account/models/account_chart_template.py", line 11, in _get_account_vals
    vals = super()._get_account_vals(
  File "/odoo/lib/python3.10/site-packages/odoo/addons/account/models/chart_template.py", line 959, in _get_account_vals
    tax_ids.append(tax_template_ref[tax].id)
AttributeError: 'int' object has no attribute 'id'

The above server error caused the following client error:
RPC_ERROR://odoo.preprod.ebtrans.acsone.eu/web/assets/412834-7f603a3/web.assets_backend.min.js:999:163)
    at XMLHttpRequest.<anonymous> (https://odoo.preprod.ebtrans.acsone.eu/web/assets/412834-7f603a3/web.assets_backend.min.js:1007:13)

@AnizR
Copy link
Contributor Author

AnizR commented Oct 29, 2024

I think that it solves the problem described in #1782

@adrienpeiffer
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1959-by-adrienpeiffer-bump-patch, awaiting test results.

Copy link
Contributor

@xavier-bouquiaux xavier-bouquiaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM : thanks for the good work

@OCA-git-bot OCA-git-bot merged commit 3d84ddc into OCA:16.0 Oct 29, 2024
11 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at b1f2861. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.

6 participants