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

[FIX] l10n_ar_tax: Cálculo de retención de ganancias. #1049

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from

Conversation

pablohmontenegro
Copy link
Contributor

Tarea: 87686
Cuando el contacto tiene el campo imp_ganancias_padron (Ganancias) distinto de "Activo" entonces no debe calcular retención de ganancias sin importar si la posición fiscal tiene retención de ganancias.

@roboadhoc
Copy link

@pablohmontenegro pablohmontenegro force-pushed the 18.0-h-87686-pam branch 8 times, most recently from 8bd4eea to 5b20997 Compare February 14, 2025 14:05
@pablohmontenegro pablohmontenegro force-pushed the 18.0-h-87686-pam branch 2 times, most recently from 4c605fe to 176438e Compare February 17, 2025 11:51
Comment on lines 22 to 30
if (
fp_tax.default_tax_id.l10n_ar_tax_type in ["earnings", "earnings_scale"]
and partner.imp_ganancias_padron == False
):
raise UserError(
self.env._(
"El contacto %s no tiene configurada inscripcion en impuesto a las ganancias" % partner.name
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do it before the for, In an if and use a filtered.
you can show the detail info of the error with the problematic partners

Comment on lines 14 to 35
# Si se va a calcular retención de ganancias previamente queremos que tenga configurado el partner
# La inscripción imp_ganancias_padron que corresponda.
if self.l10n_ar_tax_ids.filtered(
lambda x: x.tax_type == tax_type
and x.default_tax_id.l10n_ar_tax_type in ["earnings", "earnings_scale"]
and partner.imp_ganancias_padron == False
):
raise UserError(
self.env._("El contacto %s no tiene configurada inscripcion en impuesto a las ganancias" % partner.name)
)
# El filtered en la parte del "and" va a dar true para todo impuesto que no sea de ganancias.
# Si llega a ser de ganancias va a dar False en los casos que no queremmos que se calcule que son
# cuando no está inscripto o no corresponde. Si está activo en la inscripción de ganancias
# entonces va a dar True y calculará la retención de ganancias.
for fp_tax in self.l10n_ar_tax_ids.filtered(
lambda x: x.tax_type == tax_type
and (
x.default_tax_id.l10n_ar_tax_type not in ["earnings", "earnings_scale"]
if partner.imp_ganancias_padron != "AC"
else True
)
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Si se va a calcular retención de ganancias previamente queremos que tenga configurado el partner
# La inscripción imp_ganancias_padron que corresponda.
if self.l10n_ar_tax_ids.filtered(
lambda x: x.tax_type == tax_type
and x.default_tax_id.l10n_ar_tax_type in ["earnings", "earnings_scale"]
and partner.imp_ganancias_padron == False
):
raise UserError(
self.env._("El contacto %s no tiene configurada inscripcion en impuesto a las ganancias" % partner.name)
)
# El filtered en la parte del "and" va a dar true para todo impuesto que no sea de ganancias.
# Si llega a ser de ganancias va a dar False en los casos que no queremmos que se calcule que son
# cuando no está inscripto o no corresponde. Si está activo en la inscripción de ganancias
# entonces va a dar True y calculará la retención de ganancias.
for fp_tax in self.l10n_ar_tax_ids.filtered(
lambda x: x.tax_type == tax_type
and (
x.default_tax_id.l10n_ar_tax_type not in ["earnings", "earnings_scale"]
if partner.imp_ganancias_padron != "AC"
else True
)
):
for fp_tax in self.l10n_ar_tax_ids.filtered( lambda x: x.tax_type == tax_type)
if fp_tax.default_tax_id.l10n_ar_tax_type in ["earnings", "earnings_scale"]>
if partner.imp_ganancias_padron == False
raise UserError(
self.env._("El contacto %s no tiene configurada inscripcion en impuesto a las ganancias" % partner.name)
)
if partner.imp_ganancias_padron != "AC"
continue
):

Tarea: 87686
Cuando el contacto tiene el campo imp_ganancias_padron (Ganancias) distinto de "Activo" entonces no debe calcular retención de ganancias sin importar si la posición fiscal tiene retención de ganancias.
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.

3 participants