Skip to content

Commit

Permalink
feat: einvoice integration (#48)
Browse files Browse the repository at this point in the history
If the app "eu_einvoice" is installed, use it's `attach_xml_to_pdf` method when creating PDFs for Sales Invoice.
  • Loading branch information
barredterra authored Dec 5, 2024
1 parent c83969f commit a648945
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pdf_on_submit/attach_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ def publish_progress(percent):
else:
pdf_data = get_pdf_data(doctype, name, print_format, letter_head)

if doctype == "Sales Invoice" and "eu_einvoice" in frappe.get_installed_apps():
try:
from eu_einvoice.european_e_invoice.custom.sales_invoice import attach_xml_to_pdf
pdf_data = attach_xml_to_pdf(name, pdf_data)
except Exception:
msg = _("Failed to attach XML to PDF for Sales Invoice {0}").format(name)
if show_progress:
frappe.msgprint(msg, indicator="red", alert=True)
frappe.log_error(title=msg)

if show_progress:
publish_progress(66)

Expand Down

0 comments on commit a648945

Please sign in to comment.