Skip to content

[FIX] l10n_latam_check_ux: force debited state when outstanding account is not reconcilable#1031

Closed
rov-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-116447-rov
Closed

[FIX] l10n_latam_check_ux: force debited state when outstanding account is not reconcilable#1031
rov-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-116447-rov

Conversation

@rov-adhoc
Copy link
Copy Markdown
Contributor

When an own check's outstanding account (payment_method_line_id.payment_account_id) is not marked as reconcilable, the base _compute_issue_state heuristic fails: it checks whether the matched debit lines belong to accounts of type liability_payable/asset_receivable to distinguish voided vs debited, but non-reconcilable accounts are never matched that way, causing the state to fall back to voided incorrectly.

Fix: override _compute_issue_state in the UX module to inspect the outstanding_line_id.account_id.reconcile flag directly. If the account is non-reconcilable and the line is fully settled (amount_residual == 0), the check must be debited, not voided.

Copilot AI review requested due to automatic review settings April 27, 2026 12:34
@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 corrige un caso en l10n_latam_check_ux donde el estado (issue_state) de cheques propios puede quedar mal calculado cuando la cuenta outstanding no es conciliable, ajustando el cómputo para contemplar el flag reconcile de la cuenta.

Changes:

  • Se sobreescribe _compute_issue_state() en el modelo l10n_latam.check (módulo UX).
  • Se fuerza issue_state = "debited" cuando la cuenta de outstanding_line_id no es conciliable.

Comment on lines +97 to +102
)
def _compute_issue_state(self):
super()._compute_issue_state()
for rec in self:
account = rec.outstanding_line_id.account_id
if account and not account.reconcile:
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

La lógica no coincide con la descripción del fix: aquí se fuerza issue_state = 'debited' para cualquier check con outstanding_line_id.account_id no conciliable, incluso si todavía no está saldado o si super() calculó otro estado (p.ej. handed). Para evitar falsos positivos, limitar el override al caso que se quiere corregir (p.ej. cuando el estado calculado por super() sea voided y la outstanding_line_id esté totalmente saldada con amount_residual == 0).

Suggested change
)
def _compute_issue_state(self):
super()._compute_issue_state()
for rec in self:
account = rec.outstanding_line_id.account_id
if account and not account.reconcile:
"outstanding_line_id.amount_residual",
)
def _compute_issue_state(self):
super()._compute_issue_state()
for rec in self:
account = rec.outstanding_line_id.account_id
if (
rec.issue_state == "voided"
and account
and not account.reconcile
and rec.outstanding_line_id.amount_residual == 0
):

Copilot uses AI. Check for mistakes.
if payment_method_change or partner_id_change:
super()._compute_issuer_vat()

@api.depends(
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Al redecorar _compute_issue_state() con @api.depends('outstanding_line_id.account_id.reconcile') se sobrescriben las dependencias del compute original del campo. Con dependencias tan acotadas, issue_state puede no invalidarse/recomputarse cuando cambie la reconciliación (p.ej. cambios en outstanding_line_id o en su amount_residual). Mantener las dependencias del método base y añadir explícitamente las nuevas que usa este fix (al menos outstanding_line_id y outstanding_line_id.amount_residual).

Suggested change
@api.depends(
@api.depends(
"outstanding_line_id",
"outstanding_line_id.amount_residual",

Copilot uses AI. Check for mistakes.
if payment_method_change or partner_id_change:
super()._compute_issuer_vat()

@api.depends(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No agregaría depends . en todo caso modificaria el write de la cuenta contable.

…nt is not reconcilable

When an own check's outstanding account (payment_method_line_id.payment_account_id)
is not marked as reconcilable, the base _compute_issue_state heuristic fails:
it checks whether the matched debit lines belong to accounts of type
liability_payable/asset_receivable to distinguish voided vs debited, but
non-reconcilable accounts are never matched that way, causing the state to
fall back to voided incorrectly.

Fix: override _compute_issue_state in the UX module to inspect the
outstanding_line_id.account_id.reconcile flag directly. If the account is
non-reconcilable and the line is fully settled (amount_residual == 0),
the check must be debited, not voided.
@maq-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

roboadhoc pushed a commit that referenced this pull request Apr 27, 2026
…nt is not reconcilable

When an own check's outstanding account (payment_method_line_id.payment_account_id)
is not marked as reconcilable, the base _compute_issue_state heuristic fails:
it checks whether the matched debit lines belong to accounts of type
liability_payable/asset_receivable to distinguish voided vs debited, but
non-reconcilable accounts are never matched that way, causing the state to
fall back to voided incorrectly.

Fix: override _compute_issue_state in the UX module to inspect the
outstanding_line_id.account_id.reconcile flag directly. If the account is
non-reconcilable and the line is fully settled (amount_residual == 0),
the check must be debited, not voided.

closes #1031

Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
@roboadhoc roboadhoc closed this Apr 27, 2026
@roboadhoc roboadhoc deleted the 18.0-h-116447-rov branch April 27, 2026 19:47
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