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

[IMP] account_withholding: multi l10n #551

Open
wants to merge 1 commit into
base: 16.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
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"))