mirror of
https://github.com/bringout/oca-ocb-l10n_americas.git
synced 2026-04-26 10:32:02 +02:00
Initial commit: L10N_Americas packages
This commit is contained in:
commit
12b27ce151
714 changed files with 79328 additions and 0 deletions
5
odoo-bringout-oca-ocb-l10n_co/l10n_co/models/__init__.py
Normal file
5
odoo-bringout-oca-ocb-l10n_co/l10n_co/models/__init__.py
Normal 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
|
||||
|
|
@ -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")
|
||||
20
odoo-bringout-oca-ocb-l10n_co/l10n_co/models/res_partner.py
Normal file
20
odoo-bringout-oca-ocb-l10n_co/l10n_co/models/res_partner.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue