changeset bf74ba846340 in modules/account_es:6.4
details: 
https://hg.tryton.org/modules/account_es?cmd=changeset&node=bf74ba846340
description:
        Display empty values on VAT Book report for None values

        issue11588
        review443361003
        (grafted from e1d799e2f866c5e3b950dc6bdfb3a84753a1f143)
diffstat:

 reporting_tax.py |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 1913d8fd82c5 -r bf74ba846340 reporting_tax.py
--- a/reporting_tax.py  Mon May 02 17:48:41 2022 +0200
+++ b/reporting_tax.py  Sat Oct 22 01:09:53 2022 +0200
@@ -922,6 +922,8 @@
 
     @classmethod
     def format_decimal(cls, n):
+        if n is None:
+            return ''
         if not isinstance(n, Decimal):
             n = Decimal(n)
         sign = '-' if n < 0 else ''
@@ -966,14 +968,15 @@
             (record.party_tax_identifier.es_code()
                 if record.party_tax_identifier else ''),
             country_code(record),
-            record.party.name[:40],
+            record.party.name[:40] if record.party.name else '',
             '',
             cls.format_decimal(record.invoice.total_amount),
             cls.format_decimal(record.base_amount),
-            cls.format_decimal(record.tax.rate * 100),
+            (cls.format_decimal(record.tax.rate * 100)
+                if record.tax.rate is not None else ''),
             cls.format_decimal(record.tax_amount),
             (cls.format_decimal(record.surcharge_tax.rate * 100)
-                if record.surcharge_tax else ''),
+                if record.surcharge_tax is not None else ''),
             (cls.format_decimal(record.surcharge_tax_amount)
                 if record.surcharge_tax else ''),
             '',

Reply via email to