fix: invoice cancellation (#18152)
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index 2d7ffa6..407677f 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -326,6 +326,9 @@
return frappe.get_cached_value('Company', company, 'country')
def get_e_invoice_attachments(invoice):
+ if not invoice.company_tax_id:
+ return []
+
out = []
attachments = get_attachments(invoice.doctype, invoice.name)
company_tax_id = invoice.company_tax_id if invoice.company_tax_id.startswith("IT") else "IT" + invoice.company_tax_id