1717_logger = logging .getLogger (__name__ )
1818
1919
20+ COUNTRY_CODE_MAPPING = {
21+ "GB" : "XU" ,
22+ "GR" : "EL" ,
23+ }
24+
25+
2026class IntrastatProductDeclaration (models .Model ):
2127 _name = "intrastat.product.declaration"
2228 _description = "Intrastat Product Declaration"
@@ -1167,8 +1173,7 @@ def _compute_region_code(self):
11671173 def _compute_src_dest_country_code (self ):
11681174 for this in self :
11691175 code = this .src_dest_country_id and this .src_dest_country_id .code or False
1170- if code == "GB" :
1171- code = "XI" # Northern Ireland
1176+ code = self ._check_country_code (code )
11721177 this .src_dest_country_code = code
11731178
11741179 @api .depends ("product_origin_country_id" )
@@ -1179,10 +1184,7 @@ def _compute_product_origin_country_code(self):
11791184 and this .product_origin_country_id .code
11801185 or False
11811186 )
1182- if code == "GB" :
1183- code = "XU"
1184- # XU can be used when you don't know if the product
1185- # originate from Great-Britain or from Northern Ireland
1187+ code = self ._check_country_code (code )
11861188 this .product_origin_country_code = code
11871189
11881190 @api .constrains ("vat" )
@@ -1267,6 +1269,10 @@ def _prepare_declaration_line(self):
12671269 vals ["amount_company_currency" ] = int (round (vals ["amount_company_currency" ]))
12681270 return vals
12691271
1272+ def _check_country_code (self , code ):
1273+ """Check and adapt country code for Intrastat purpose"""
1274+ return COUNTRY_CODE_MAPPING .get (code , code )
1275+
12701276
12711277class IntrastatProductDeclarationLine (models .Model ):
12721278 _name = "intrastat.product.declaration.line"
0 commit comments