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
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
10 changes: 10 additions & 0 deletions l10n_ar_tax/models/account_fiscal_position.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from odoo import fields, models
from odoo.exceptions import UserError


class AccountFiscalPosition(models.Model):
Expand All @@ -11,6 +12,15 @@ def _l10n_ar_add_taxes(self, partner, company, date, tax_type):
self.ensure_one()
taxes = self.env["account.tax"]
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"]:
# 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 partner.imp_ganancias_padron == False:
raise UserError(
self.env._("The partner %s does not have the profits inscription set." % partner.name)
)
if partner.imp_ganancias_padron != "AC":
continue
domain = self.env["l10n_ar.partner.tax"]._check_company_domain(company)
domain += [("tax_id.tax_group_id", "=", fp_tax.default_tax_id.tax_group_id.id)]
if tax_type == "withholding":
Expand Down