From 61f7e5bdb92a5fbcc00f4ee382542fdd359b4538 Mon Sep 17 00:00:00 2001 From: cubells Date: Wed, 20 Sep 2017 19:18:51 +0200 Subject: [PATCH] [FIX] intrastat_product: state can be None --- intrastat_product/__manifest__.py | 2 +- intrastat_product/models/intrastat_product_declaration.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/intrastat_product/__manifest__.py b/intrastat_product/__manifest__.py index 9e3f0a1..a7c5bc4 100644 --- a/intrastat_product/__manifest__.py +++ b/intrastat_product/__manifest__.py @@ -6,7 +6,7 @@ { 'name': 'Intrastat Product', - 'version': '10.0.1.0.0', + 'version': '10.0.1.1.0', 'category': 'Intrastat', 'license': 'AGPL-3', 'summary': 'Base module for Intrastat Product', diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index d917e37..43053d0 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -177,6 +177,9 @@ class IntrastatProductDeclaration(models.Model): def _compute_company_country_code(self): for this in self: if this.company_id: + if not this.company_id.country_id: + raise ValidationError( + _("You must set company's country !")) this.company_country_code = \ this.company_id.country_id.code.lower()