diff --git a/modules/account/general_ledger.fodt b/modules/account/general_ledger.fodt
index 28f75b455a..8d4cd36328 100644
--- a/modules/account/general_ledger.fodt
+++ b/modules/account/general_ledger.fodt
@@ -913,7 +913,7 @@
<line.description or ''>
- <getattr(line.origin, 'rec_name', '')>
+ <line.origin and line.origin.rec_name or ''>
diff --git a/modules/edocument_ubl/template/2/base.xml b/modules/edocument_ubl/template/2/base.xml
index 8363fb6768..b54961e6e6 100644
--- a/modules/edocument_ubl/template/2/base.xml
+++ b/modules/edocument_ubl/template/2/base.xml
@@ -84,7 +84,7 @@ this repository contains the full copyright notices and license terms. -->
${tax.unece_category_code}
${format((tax.rate * 100).normalize(), 'f')}
- ${tax.vatex_code}
+ ${tax.vatex_code}
${tax.legal_notice}
${tax.unece_code}
diff --git a/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml b/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
index 0f84f4df05..25ba81b3f5 100644
--- a/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
+++ b/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
@@ -45,7 +45,7 @@ this repository contains the full copyright notices and license terms. -->
${amount * this.type_sign}
${tax.unece_code}
- ${tax.vatex_code}
+ ${tax.vatex_code}
${tax.legal_notice}
${base * this.type_sign}
${tax.unece_category_code}
diff --git a/modules/stock_shipment_customs/commercial_invoice.fodt b/modules/stock_shipment_customs/commercial_invoice.fodt
index fbd39c476d..84f3a14719 100644
--- a/modules/stock_shipment_customs/commercial_invoice.fodt
+++ b/modules/stock_shipment_customs/commercial_invoice.fodt
@@ -710,7 +710,7 @@
Date: <format_date(shipment.effective_date or shipment.planned_date) if (shipment.effective_date or shipment.planned_date) else ''>
Terms of Trade: <shipment.incoterm.name if shipment.incoterm else ''>
Reason for Export: <get_reason(shipment)>
- Carrier: <shipment.carrier.rec_name if getattr(shipment, 'carrier', None) else ''>
+ Carrier: <shipment.carrier.rec_name if hasattr(shipment, 'carrier') and shipment.carrier else ''>
Shipping reference: <shipment.shipping_reference>