[IMP] l10n_co: remove unused field
Followup of https://github.com/odoo/odoo/commit/b44f559fe7577afdaa83511bdf0b6ca47ffeb8b7 closes odoo/odoo#50862 Related: odoo/upgrade#1164 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -17,36 +17,6 @@ class ResPartner(models.Model):
|
||||
('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.')
|
||||
l10n_co_verification_code = fields.Char(compute='_compute_verification_code', string='VC', # todo remove this field in master
|
||||
help='Redundancy check to verify the vat number has been typed in correctly.')
|
||||
|
||||
@api.depends('vat')
|
||||
def _compute_verification_code(self):
|
||||
multiplication_factors = [71, 67, 59, 53, 47, 43, 41, 37, 29, 23, 19, 17, 13, 7, 3]
|
||||
|
||||
for partner in self:
|
||||
if partner.vat and partner.country_id == self.env.ref('base.co') and len(partner.vat) <= len(multiplication_factors):
|
||||
number = 0
|
||||
padded_vat = partner.vat
|
||||
|
||||
while len(padded_vat) < len(multiplication_factors):
|
||||
padded_vat = '0' + padded_vat
|
||||
|
||||
# if there is a single non-integer in vat the verification code should be False
|
||||
try:
|
||||
for index, vat_number in enumerate(padded_vat):
|
||||
number += int(vat_number) * multiplication_factors[index]
|
||||
|
||||
number %= 11
|
||||
|
||||
if number < 2:
|
||||
partner.l10n_co_verification_code = number
|
||||
else:
|
||||
partner.l10n_co_verification_code = 11 - number
|
||||
except ValueError:
|
||||
partner.l10n_co_verification_code = False
|
||||
else:
|
||||
partner.l10n_co_verification_code = False
|
||||
|
||||
@api.constrains('vat', 'country_id', 'l10n_co_document_type')
|
||||
def check_vat(self):
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
<field name="vat" position="before">
|
||||
<field name="l10n_co_document_type"/>
|
||||
</field>
|
||||
<field name="vat" position="after">
|
||||
<field name="l10n_co_verification_code" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user