Skip to content

[FIX] account_multicompany_ux: synchronize balances with amount_currency before write operations#287

Closed
cem-adhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-t-118026-cem
Closed

[FIX] account_multicompany_ux: synchronize balances with amount_currency before write operations#287
cem-adhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-t-118026-cem

Conversation

@cem-adhoc
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 15:05
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Este PR ajusta el wizard de cambio de compañía (account.change.company) para sincronizar balance con amount_currency antes de ejecutar escrituras que pueden disparar validaciones de balanceo, evitando errores durante el cambio de compañía en asientos/facturas multi-moneda.

Changes:

  • Se adelanta la llamada a _sync_lines_balance_from_amount_currency(move) para que ocurra antes de writes que pueden disparar _check_balanced.
  • Se envuelve la sincronización en un contexto de _disable_recursion(..., 'check_move_validity', ...) para evitar validaciones recursivas durante el ajuste.
  • Se elimina la sincronización tardía (previa al bloque final _check_balanced/_sync_dynamic_lines) al final del método.

# que dispare _check_balanced (eg. invoice_payment_term_id)
container = {'records': move}
with move._disable_recursion(container, 'check_move_validity', default=True, target=False):
self._sync_lines_balance_from_amount_currency(move)
Comment on lines +163 to +168
# Sincronizar balances con amount_currency antes de cualquier write
# que dispare _check_balanced (eg. invoice_payment_term_id)
container = {'records': move}
with move._disable_recursion(container, 'check_move_validity', default=True, target=False):
self._sync_lines_balance_from_amount_currency(move)

@cem-adhoc cem-adhoc force-pushed the 18.0-t-118026-cem branch from 987a60f to 81696d8 Compare May 21, 2026 15:10
@rov-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

roboadhoc pushed a commit that referenced this pull request May 26, 2026
…ncy before write operations

closes #287

Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
@roboadhoc roboadhoc closed this May 26, 2026
@fw-bot-adhoc fw-bot-adhoc deleted the 18.0-t-118026-cem branch June 2, 2026 12:57
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

Successfully merging this pull request may close these issues.

4 participants