From 3aa5d908fb79a534563e4e8b351fa6f605e25631 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 28 Oct 2019 13:42:32 +0100 Subject: [PATCH] intrastat_product: fix crash in XLS export when there is empty data in compute line --- .../report/intrastat_product_report_xls.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/intrastat_product/report/intrastat_product_report_xls.py b/intrastat_product/report/intrastat_product_report_xls.py index 3c4911e..b4d378b 100644 --- a/intrastat_product/report/intrastat_product_report_xls.py +++ b/intrastat_product/report/intrastat_product_report_xls.py @@ -33,7 +33,7 @@ class IntrastatProductDeclarationXlsx(AbstractReportXlsx): }, 'line': { 'value': self._render( - "line.product_id and line.product_id.name"), + "line.product_id.display_name or ''"), }, 'width': 36, }, @@ -57,7 +57,7 @@ class IntrastatProductDeclarationXlsx(AbstractReportXlsx): 'line': { 'type': 'string', 'value': self._render( - "line.hs_code_id.local_code"), + "line.hs_code_id.local_code or ''"), }, 'width': 14, }, @@ -69,7 +69,7 @@ class IntrastatProductDeclarationXlsx(AbstractReportXlsx): 'line': { 'type': 'string', 'value': self._render( - "line.src_dest_country_id.name"), + "line.src_dest_country_id.name or ''"), }, 'width': 28, }, @@ -107,7 +107,7 @@ class IntrastatProductDeclarationXlsx(AbstractReportXlsx): }, 'line': { 'value': self._render( - "line.transaction_id.display_name"), + "line.transaction_id.display_name or ''"), }, 'width': 36, }, @@ -188,7 +188,7 @@ class IntrastatProductDeclarationXlsx(AbstractReportXlsx): 'value': self._('Invoice'), }, 'line': { - 'value': self._render("line.invoice_id.number"), + 'value': self._render("line.invoice_id.number or ''"), }, 'width': 18, },