Initial commit: L10N_Americas packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 12b27ce151
714 changed files with 79328 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# coding: utf-8
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import l10n_latam_identification_type
from . import res_partner

View file

@ -0,0 +1,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class L10nCoDocumentType(models.Model):
_inherit = "l10n_latam.identification.type"
l10n_co_document_code = fields.Char("Document Code")

View file

@ -0,0 +1,20 @@
# coding: utf-8
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, api
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.constrains('vat', 'country_id', 'l10n_latam_identification_type_id')
def check_vat(self):
# check_vat is implemented by base_vat which this localization
# doesn't directly depend on. It is however automatically
# installed for Colombia.
if self.sudo().env.ref('base.module_base_vat').state == 'installed':
# don't check Colombian partners unless they have RUT (= Colombian VAT) set as document type
self = self.filtered(lambda partner: partner.country_id.code != "CO" or\
partner.l10n_latam_identification_type_id.l10n_co_document_code == 'rut')
return super(ResPartner, self).check_vat()
else:
return True