chore: check if discount_percentage exists
fixes TypeError: '>' not supported between instances of 'NoneType' and 'float'
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
diff --git a/erpnext/regional/italy/e-invoice.xml b/erpnext/regional/italy/e-invoice.xml
index 0a5bb29..049a7eb 100644
--- a/erpnext/regional/italy/e-invoice.xml
+++ b/erpnext/regional/italy/e-invoice.xml
@@ -19,7 +19,7 @@
{%- endmacro %}
{%- macro render_discount_or_margin(item) -%}
-{%- if item.discount_percentage > 0.0 or item.margin_type %}
+{%- if (item.discount_percentage and item.discount_percentage > 0.0) or item.margin_type %}
<ScontoMaggiorazione>
{%- if item.discount_percentage > 0.0 %}
<Tipo>SC</Tipo>