mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[IMP] intrastat_product: add support for Brexit + small performance improvement + remove universal hs_code constaint
Add support for post-Brexit VAT numbers with latest python-stdnum version Remove use of country_id.intrastat Add 'vat' field on computation and declaration lines with a simple validity check Add 'partner_id' field on computation lines Prevent back to draft when an XML export is present Remove the universal constaint applied to the hs_codes for countries in the "Europe" list, as discussed in https://github.com/OCA/intrastat-extrastat/pull/116#discussion_r569735555 Co-authored-by: Alexis de Lattre <alexis.delattre@akretion.com>
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
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))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user