Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions l10n_ar_tax/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def _compute_fiscal_position_id(self):
rec.l10n_ar_fiscal_position_id = (
self.env["account.fiscal.position"]
.with_company(rec.company_id)
# TODO revisar porque llega active_test=False acá
.with_context(l10n_ar_withholding=True, active_test=True)
.with_context(l10n_ar_withholding=True)
._get_fiscal_position(address)
)

Expand Down Expand Up @@ -310,8 +309,10 @@ def _compute_withholdable_advanced_amount(self):

@api.depends("l10n_ar_fiscal_position_id", "partner_id", "company_id", "date")
def _compute_l10n_ar_withholding_line_ids(self):
# no entiendo porque pero acá viene un active_test=False que se termina propagando a computed fields que
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

Typo en el comentario: "porque" debería ser "por qué" (con tilde y separado) cuando se formula una pregunta indirecta. También falta tilde en "acá" → "acá".

Suggested change
# no entiendo porque pero acá viene un active_test=False que se termina propagando a computed fields que
# no entiendo por qué pero acá viene un active_test=False que se termina propagando a computed fields que

Copilot uses AI. Check for mistakes.
# también dependan de partner_id, por ahora forzamos active_test=True para que aguas arriba todo se compute bien
Comment on lines +312 to +313
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

El comentario indica "no entiendo porque" y "por ahora forzamos". Este enfoque temporal puede causar problemas de mantenibilidad a largo plazo. Se recomienda investigar la causa raíz del active_test=False que llega al contexto (posiblemente desde dependencias del ORM o triggers de campos relacionados) para aplicar una solución definitiva en lugar de este parche. Considerar agregar un task o TODO con referencia para investigar esto más adelante.

Copilot generated this review using guidance from repository custom instructions.
# metodo completamente analogo a payment.register._compute_l10n_ar_withholding_ids
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

El comentario menciona que el método es "completamente analogo" a payment.register._compute_l10n_ar_withholding_ids, pero revisando el wizard account_payment_register.py, el método _compute_l10n_ar_withholding_ids NO aplica el parche de with_context(active_test=True) en su bucle. Esto crea una inconsistencia entre ambos métodos que se supone son análogos. Se recomienda verificar si el wizard también necesita el parche o si el comentario sobre la analogía es inexacto.

Suggested change
# metodo completamente analogo a payment.register._compute_l10n_ar_withholding_ids
# método basado en payment.register._compute_l10n_ar_withholding_ids, con este parche extra de active_test

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

Typo ortográfico: "analogo" debe llevar tilde → "análogo".

Suggested change
# metodo completamente analogo a payment.register._compute_l10n_ar_withholding_ids
# método completamente análogo a payment.register._compute_l10n_ar_withholding_ids

Copilot uses AI. Check for mistakes.
for rec in self.filtered(lambda x: x.partner_type == "supplier"):
for rec in self.with_context(active_test=True).filtered(lambda x: x.partner_type == "supplier"):
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

Inconsistencia en el manejo de active_test: en _compute_fiscal_position_id (línea 58) se eliminó el active_test=True del contexto, pero en _compute_l10n_ar_withholding_line_ids (línea 315) se agrega. Ambos métodos interactúan con account.fiscal.position y pueden invocar a _get_fiscal_position. Esta inconsistencia podría causar comportamiento diferente entre los dos métodos compute. Se recomienda aplicar la misma estrategia en ambos lugares o documentar por qué un método necesita el parche y el otro no.

Copilot uses AI. Check for mistakes.
date = rec.date or fields.Date.today()
withholdings = [Command.clear()]
if rec.l10n_ar_fiscal_position_id.l10n_ar_tax_ids:
Expand Down