From d40c36d909b3145d3c2efe1fbd72b5dbb80db052 Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Mon, 17 May 2021 13:10:06 +0200 Subject: [PATCH] [13.0][IMP]intrastat_product: remove universal constrain for hs_code --- intrastat_product/models/hs_code.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/intrastat_product/models/hs_code.py b/intrastat_product/models/hs_code.py index 91a82ed..409df2e 100644 --- a/intrastat_product/models/hs_code.py +++ b/intrastat_product/models/hs_code.py @@ -3,8 +3,7 @@ # @author Alexis de Lattre # @author Luc de Meyer -from odoo import _, api, fields, models -from odoo.exceptions import ValidationError +from odoo import fields, models class HSCode(models.Model): @@ -13,24 +12,3 @@ class HSCode(models.Model): intrastat_unit_id = fields.Many2one( comodel_name="intrastat.unit", string="Intrastat Supplementary Unit" ) - - @api.constrains("local_code") - def _hs_code(self): - if self.company_id.country_id.intrastat: - if not self.local_code.isdigit(): - raise ValidationError( - _( - "Intrastat Codes should only contain digits. " - "This is not the case for code '%s'." - ) - % self.local_code - ) - if len(self.local_code) != 8: - raise ValidationError( - _( - "Intrastat Codes should " - "contain 8 digits. This is not the case for " - "Intrastat Code '%s' which has %d digits." - ) - % (self.local_code, len(self.local_code)) - )