[IMP] base_vat: remove simple check vat for co
- removed simple check vat for columbia
- removed document type field from partner
- document type will be managed by latam type
- updated city name for colombia
- added data for for latam identification type
- Added depdencies
- base_address_city
- account_debit_note
- l10n_latam_base
task- 2190843
closes odoo/odoo#53040
Related: odoo/upgrade#1589
Related: odoo/enterprise#9567
Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
committed by
Josse Colpaert
parent
9cf8da90d5
commit
34c4752eea
@@ -223,26 +223,6 @@ class ResPartner(models.Model):
|
||||
checksum = extra + sum((8-i) * int(x) for i, x in enumerate(vat[:7]))
|
||||
return 'WABCDEFGHIJKLMNOPQRSTUV'[checksum % 23]
|
||||
|
||||
def check_vat_co(self, rut):
|
||||
'''
|
||||
Check Colombian RUT number.
|
||||
Method copied from vatnumber 1.2 lib https://code.google.com/archive/p/vatnumber/
|
||||
'''
|
||||
if len(rut) != 10:
|
||||
return False
|
||||
try:
|
||||
int(rut)
|
||||
except ValueError:
|
||||
return False
|
||||
nums = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71]
|
||||
sum = 0
|
||||
for i in range(len(rut) - 2, -1, -1):
|
||||
sum += int(rut[i]) * nums[len(rut) - 2 - i]
|
||||
if sum % 11 > 1:
|
||||
return int(rut[-1]) == 11 - (sum % 11)
|
||||
else:
|
||||
return int(rut[-1]) == sum % 11
|
||||
|
||||
def check_vat_ie(self, vat):
|
||||
""" Temporary Ireland VAT validation to support the new format
|
||||
introduced in January 2013 in Ireland, until upstream is fixed.
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
'website': 'https://xoe.solutions',
|
||||
'depends': [
|
||||
'account',
|
||||
'base_address_city',
|
||||
'account_debit_note',
|
||||
'l10n_latam_base',
|
||||
],
|
||||
'data': [
|
||||
'data/l10n_co_chart_data.xml',
|
||||
@@ -25,7 +28,7 @@
|
||||
'data/account.tax.group.csv',
|
||||
'data/account_tax_template.xml',
|
||||
'data/account_chart_template_configure_data.xml',
|
||||
'views/res_partner.xml',
|
||||
'data/l10n_latam.identification.type.csv',
|
||||
],
|
||||
'demo': [
|
||||
'demo/demo_company.xml',
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
id,name,l10n_co_document_code,country_id:id,is_vat,sequence
|
||||
rut,NIT,rut,base.co,TRUE,1
|
||||
national_citizen_id,Cédula de ciudadanía,national_citizen_id,base.co,FALSE,2
|
||||
external_id,ID del Exterior,external_id,base.co,FALSE,3
|
||||
foreign_id_card,Cédula Extranjera,foreign_id_card,base.co,FALSE,4
|
||||
passport,Pasaporte,passport,base.co,FALSE,5
|
||||
id_card,Tarjeta de Identidad,id_card,base.co,FALSE,6
|
||||
civil_registration,Registro Civil,civil_registration,base.co,FALSE,7
|
||||
diplomatic_card,Carné Diplomatico,diplomatic_card,base.co,FALSE,8
|
||||
residence_document,Salvoconducto de Permanencia,residence_document,base.co,FALSE,9
|
||||
id_document,Cédula,id_document,base.co,FALSE,10
|
||||
|
@@ -1,4 +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")
|
||||
@@ -1,24 +1,12 @@
|
||||
# coding: utf-8
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models, api
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
l10n_co_document_type = fields.Selection([('rut', 'NIT'),
|
||||
('id_document', 'Cédula'),
|
||||
('id_card', 'Tarjeta de Identidad'),
|
||||
('passport', 'Pasaporte'),
|
||||
('foreign_id_card', 'Cédula Extranjera'),
|
||||
('external_id', 'ID del Exterior'),
|
||||
('diplomatic_card', 'Carné Diplomatico'),
|
||||
('residence_document', 'Salvoconducto de Permanencia'),
|
||||
('civil_registration', 'Registro Civil'),
|
||||
('national_citizen_id', 'Cédula de ciudadanía')], string='Document Type',
|
||||
help='Indicates to what document the information in here belongs to.')
|
||||
|
||||
@api.constrains('vat', 'country_id', 'l10n_co_document_type')
|
||||
@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
|
||||
@@ -26,7 +14,7 @@ class ResPartner(models.Model):
|
||||
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 != self.env.ref('base.co') or\
|
||||
partner.l10n_co_document_type == 'rut')
|
||||
partner.l10n_latam_identification_type_id.l10n_co_document_code == 'rut')
|
||||
return super(ResPartner, self).check_vat()
|
||||
else:
|
||||
return True
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="view_partner_form_inherit_l10n_co">
|
||||
<field name="name">res.partner.l10n_co.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="vat" position="before">
|
||||
<field name="l10n_co_document_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -647,7 +647,7 @@ state_id_su,id,"Sumatra Utara","SU"
|
||||
state_id_yo,id,"Yogyakarta","YO"
|
||||
state_co_01,co,"Antioquia","ANT"
|
||||
state_co_02,co,"Atlántico","ATL"
|
||||
state_co_03,co,"D.C.","DC"
|
||||
state_co_03,co,"Bogotá","DC"
|
||||
state_co_04,co,"Bolívar","BOL"
|
||||
state_co_05,co,"Boyacá","BOY"
|
||||
state_co_06,co,"Caldas","CAL"
|
||||
@@ -663,7 +663,7 @@ state_co_15,co,"Magdalena","MAG"
|
||||
state_co_16,co,"Meta","MET"
|
||||
state_co_17,co,"Nariño","NAR"
|
||||
state_co_18,co,"Norte de Santander","NSA"
|
||||
state_co_19,co,"Quindio","QUI"
|
||||
state_co_19,co,"Quindío","QUI"
|
||||
state_co_20,co,"Risaralda","RIS"
|
||||
state_co_21,co,"Santander","SAN"
|
||||
state_co_22,co,"Sucre","SUC"
|
||||
@@ -672,7 +672,7 @@ state_co_24,co,"Valle del Cauca","VAC"
|
||||
state_co_25,co,"Arauca","ARA"
|
||||
state_co_26,co,"Casanare","CAS"
|
||||
state_co_27,co,"Putumayo","PUT"
|
||||
state_co_28,co,"Archipiélago de San Andrés, Providencia y Santa Catalina","SAP"
|
||||
state_co_28,co,"San Andrés y Providencia","SAP"
|
||||
state_co_29,co,"Amazonas","AMA"
|
||||
state_co_30,co,"Guainía","GUA"
|
||||
state_co_31,co,"Guaviare","GUV"
|
||||
|
||||
|
Reference in New Issue
Block a user