[FIX] intrastat_product: state can be None

This commit is contained in:
cubells
2017-09-20 19:18:51 +02:00
committed by João Marques
parent 4bbb1d7cda
commit 61f7e5bdb9
2 changed files with 4 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
{ {
'name': 'Intrastat Product', 'name': 'Intrastat Product',
'version': '10.0.1.0.0', 'version': '10.0.1.1.0',
'category': 'Intrastat', 'category': 'Intrastat',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Base module for Intrastat Product', 'summary': 'Base module for Intrastat Product',

View File

@@ -177,6 +177,9 @@ class IntrastatProductDeclaration(models.Model):
def _compute_company_country_code(self): def _compute_company_country_code(self):
for this in self: for this in self:
if this.company_id: 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_country_code = \
this.company_id.country_id.code.lower() this.company_id.country_id.code.lower()