From 964037e9dcabcf89304ebf687ce9a5c79de8ccea Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Thu, 12 May 2022 10:30:10 +0200 Subject: [PATCH] [14.0]brexit support - size=2 on product_origin_country_code --- intrastat_product/models/account_move.py | 11 ++--------- .../models/intrastat_product_declaration.py | 2 ++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/intrastat_product/models/account_move.py b/intrastat_product/models/account_move.py index 0fc9bca..6c7e143 100644 --- a/intrastat_product/models/account_move.py +++ b/intrastat_product/models/account_move.py @@ -3,8 +3,7 @@ # @author Alexis de Lattre # @author Luc de Meyer -from odoo import _, api, fields, models -from odoo.exceptions import UserError +from odoo import api, fields, models class AccountMove(models.Model): @@ -180,6 +179,7 @@ class AccountMoveIntrastatLine(models.Model): ) product_origin_country_code = fields.Char( string="Country of Origin of the Product", + size=2, required=True, default="QU", help="2 digit code of country of origin of the product except for the UK.\n" @@ -212,10 +212,3 @@ class AccountMoveIntrastatLine(models.Model): vals["product_origin_country_code"] = ( vals["product_origin_country_code"].upper().strip() ) - if len(vals["product_origin_country_code"]) != 2: - raise UserError( - _( - "Intrastat transaction details error:\n" - "Product Origin Country Code must be 2 characters." - ) - ) diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index 4518967..ca066ec 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -1139,6 +1139,7 @@ class IntrastatProductComputationLine(models.Model): ) product_origin_country_code = fields.Char( string="Country of Origin of the Product", + size=2, required=True, default="QU", help="2 digit code of country of origin of the product except for the UK.\n" @@ -1251,6 +1252,7 @@ class IntrastatProductDeclarationLine(models.Model): ) product_origin_country_code = fields.Char( string="Country of Origin of the Product", + size=2, required=True, default="QU", help="2 digit code of country of origin of the product except for the UK.\n"