details: https://code.tryton.org/tryton/commit/1a0574d67704
branch: default
user: Cédric Krier <[email protected]>
date: Tue Jun 09 13:01:23 2026 +0200
description:
Replace getattr by hasattr in report
diffstat:
modules/account/general_ledger.fodt | 4 ++--
modules/edocument_ubl/template/2/base.xml | 2 +-
modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml | 2 +-
modules/stock_shipment_customs/commercial_invoice.fodt | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r 101aaf12c6bb -r 1a0574d67704 modules/account/general_ledger.fodt
--- a/modules/account/general_ledger.fodt Mon Jun 08 23:44:10 2026 +0200
+++ b/modules/account/general_ledger.fodt Tue Jun 09 13:01:23 2026 +0200
@@ -982,7 +982,7 @@
<text:p text:style-name="P22"><text:placeholder
text:placeholder-type="text"><line.description or
''></text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table4.G5" office:value-type="string">
- <text:p text:style-name="P22"><text:placeholder
text:placeholder-type="text"><getattr(line.origin, 'rec_name',
'')></text:placeholder></text:p>
+ <text:p text:style-name="P22"><text:placeholder
text:placeholder-type="text"><line.origin and line.origin.rec_name or
''></text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table4.1">
@@ -1137,7 +1137,7 @@
<text:p text:style-name="Table_20_Contents"><text:placeholder
text:placeholder-type="text"><line.description or
''></text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Lines.G5" office:value-type="string">
- <text:p text:style-name="Table_20_Contents"><text:placeholder
text:placeholder-type="text"><getattr(line.origin, 'rec_name',
'')></text:placeholder></text:p>
+ <text:p text:style-name="Table_20_Contents"><text:placeholder
text:placeholder-type="text"><line.origin and line.origin.rec_name or
''></text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Lines.1">
diff -r 101aaf12c6bb -r 1a0574d67704 modules/edocument_ubl/template/2/base.xml
--- a/modules/edocument_ubl/template/2/base.xml Mon Jun 08 23:44:10 2026 +0200
+++ b/modules/edocument_ubl/template/2/base.xml Tue Jun 09 13:01:23 2026 +0200
@@ -84,7 +84,7 @@
<py:def function="TaxCategory(tax)">
<cbc:ID
py:if="tax.unece_category_code">${tax.unece_category_code}</cbc:ID>
<cbc:Percent py:if="tax.type == 'percentage'">${format((tax.rate *
100).normalize(), 'f')}</cbc:Percent>
- <cbc:TaxExemptionReasonCode py:if="getattr(tax, 'vatex_code',
None)">${tax.vatex_code}</cbc:TaxExemptionReasonCode>
+ <cbc:TaxExemptionReasonCode py:if="hasattr(tax, 'vatex_code') and
tax.vatex_code">${tax.vatex_code}</cbc:TaxExemptionReasonCode>
<cbc:TaxExemptionReason
py:if="tax.legal_notice">${tax.legal_notice}</cbc:TaxExemptionReason>
<cac:TaxScheme py:if="tax.unece_code">
<cbc:ID>${tax.unece_code}</cbc:ID>
diff -r 101aaf12c6bb -r 1a0574d67704
modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
--- a/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
Mon Jun 08 23:44:10 2026 +0200
+++ b/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml
Tue Jun 09 13:01:23 2026 +0200
@@ -45,7 +45,7 @@
<ram:ApplicableTradeTax>
<ram:CalculatedAmount py:if="amount" py:attrs="{'currencyID':
this.invoice.currency.code}">${amount * this.type_sign}</ram:CalculatedAmount>
<ram:TypeCode
py:if="tax.unece_code">${tax.unece_code}</ram:TypeCode>
- <ram:ExemptionReasonCode py:if="getattr(tax, 'vatex_code',
None)">${tax.vatex_code}</ram:ExemptionReasonCode>
+ <ram:ExemptionReasonCode py:if="hasattr(tax, 'vatex_code') and
tax.vatex_code">${tax.vatex_code}</ram:ExemptionReasonCode>
<ram:ExemptionReason
py:if="tax.legal_notice">${tax.legal_notice}</ram:ExemptionReason>
<ram:BasisAmount py:if="base">${base *
this.type_sign}</ram:BasisAmount>
<ram:CategoryCode
py:if="tax.unece_category_code">${tax.unece_category_code}</ram:CategoryCode>
diff -r 101aaf12c6bb -r 1a0574d67704
modules/stock_shipment_customs/commercial_invoice.fodt
--- a/modules/stock_shipment_customs/commercial_invoice.fodt Mon Jun 08
23:44:10 2026 +0200
+++ b/modules/stock_shipment_customs/commercial_invoice.fodt Tue Jun 09
13:01:23 2026 +0200
@@ -710,7 +710,7 @@
<text:p text:style-name="Text_20_body">Date: <text:placeholder
text:placeholder-type="text"><format_date(shipment.effective_date or
shipment.planned_date) if (shipment.effective_date or shipment.planned_date)
else ''></text:placeholder></text:p>
<text:p text:style-name="P54">Terms of Trade: <text:placeholder
text:placeholder-type="text"><shipment.incoterm.name if shipment.incoterm
else ''></text:placeholder></text:p>
<text:p text:style-name="P37">Reason for Export: <text:placeholder
text:placeholder-type="text"><get_reason(shipment)></text:placeholder></text:p>
- <text:p text:style-name="P57">Carrier: <text:placeholder
text:placeholder-type="text"><shipment.carrier.rec_name if getattr(shipment,
'carrier', None) else ''></text:placeholder></text:p>
+ <text:p text:style-name="P57">Carrier: <text:placeholder
text:placeholder-type="text"><shipment.carrier.rec_name if hasattr(shipment,
'carrier') and shipment.carrier else
''></text:placeholder></text:p>
<text:p text:style-name="P57">Shipping reference: <text:placeholder
text:placeholder-type="text"><shipment.shipping_reference></text:placeholder></text:p>
</text:section>
<text:section text:style-name="Sect2" text:name="Section4">