Skip to content

Commit

Permalink
[IMP] account_withholding: multi l10n
Browse files Browse the repository at this point in the history
Avoid configure and create taxes with tax_type_use options
"Customer Payment" or "Supplier Payment" if not Argentina company

Ticket 81960
  • Loading branch information
zaoral committed Oct 30, 2024
1 parent 5ad7a76 commit ca9274b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions account_withholding/models/account_tax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from odoo import models, fields, api
from odoo import models, fields, api, _
from odoo.addons.account.models.account_tax import TYPE_TAX_USE

from odoo.exceptions import ValidationError

TYPE_TAX_USE += [('customer', 'Customer Payment'), ('supplier', 'Supplier Payment')]

Expand Down Expand Up @@ -41,3 +41,12 @@ def create(self, vals_list):
'company_id': tax.company_id.id,
}).id
return recs

@api.constrains('type_tax_use')
def check_type_tax_use_ar(self):
""" Las opciones "Customer Payment" y "Supplier Payment" estan definidas solo para ser usadas en la
lógica de compañias con loc argentina, evitamos el uso de esta configuracion de impuestos para otras
localizaciones """
if self.filtered(lambda x: x.type_tax_use in ["customer", "supplier"] and x.country_code != "AR"):
raise ValidationError(_(
"Este Tipo de Impuesto es solo compatible en compañias con Localización Argentina"))

0 comments on commit ca9274b

Please sign in to comment.