diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py index 90c489ec2ce..835c1083afc 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py @@ -250,11 +250,11 @@ class AccountEdiXmlCII(models.AbstractModel): narration = "" note_node = tree.find('./{*}ExchangedDocument/{*}IncludedNote/{*}Content') - if note_node is not None: + if note_node is not None and note_node.text: narration += note_node.text + "\n" payment_terms_node = tree.find('.//{*}SpecifiedTradePaymentTerms/{*}Description') - if payment_terms_node is not None: + if payment_terms_node is not None and payment_terms_node.text: narration += payment_terms_node.text + "\n" invoice.narration = narration @@ -268,7 +268,7 @@ class AccountEdiXmlCII(models.AbstractModel): # ==== invoice_date ==== invoice_date_node = tree.find('./{*}ExchangedDocument/{*}IssueDateTime/{*}DateTimeString') - if invoice_date_node is not None: + if invoice_date_node is not None and invoice_date_node.text: date_str = invoice_date_node.text date_obj = datetime.strptime(date_str, DEFAULT_FACTURX_DATE_FORMAT) invoice.invoice_date = date_obj.strftime(DEFAULT_SERVER_DATE_FORMAT) @@ -276,7 +276,7 @@ class AccountEdiXmlCII(models.AbstractModel): # ==== invoice_date_due ==== invoice_date_due_node = tree.find('.//{*}SpecifiedTradePaymentTerms/{*}DueDateDateTime/{*}DateTimeString') - if invoice_date_due_node is not None: + if invoice_date_due_node is not None and invoice_date_due_node.text: date_str = invoice_date_due_node.text date_obj = datetime.strptime(date_str, DEFAULT_FACTURX_DATE_FORMAT) invoice.invoice_date_due = date_obj.strftime(DEFAULT_SERVER_DATE_FORMAT) diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py index 08074c35ceb..c9b9cd3f679 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py @@ -501,7 +501,7 @@ class AccountEdiXmlUBL20(models.AbstractModel): narration += note_node.text + "\n" payment_terms_node = tree.find('./{*}PaymentTerms/{*}Note') # e.g. 'Payment within 10 days, 2% discount' - if payment_terms_node is not None: + if payment_terms_node is not None and payment_terms_node.text: narration += payment_terms_node.text + "\n" invoice.narration = narration @@ -515,14 +515,14 @@ class AccountEdiXmlUBL20(models.AbstractModel): # ==== invoice_date ==== invoice_date_node = tree.find('./{*}IssueDate') - if invoice_date_node is not None: + if invoice_date_node is not None and invoice_date_node.text: invoice.invoice_date = invoice_date_node.text # ==== invoice_date_due ==== for xpath in ('./{*}DueDate', './/{*}PaymentDueDate'): invoice_date_due_node = tree.find(xpath) - if invoice_date_due_node is not None: + if invoice_date_due_node is not None and invoice_date_due_node.text: invoice.invoice_date_due = invoice_date_due_node.text break