-
Notifications
You must be signed in to change notification settings - Fork 64
ZUGFeRD (and FacturX)
Factur-X or ZUGFeRD is an industry standard for electronic invoices. Refer to https://www.ferd-net.de/zugferd/definition/was-ist-zugferd.html for more details.
The ZUGFeRD module in ERPNextSwiss provides an implementation according to EN 16931 for electronic invoices. It can
- create electronic invoices from Sales Invoices (PDF with Factur-X content)
- create new purchase invoices from a electronic invoices
- Open the sales invoice and click the e-PDF button. This will create a downloadable pdf with an electronic invoice part
- Click Make > Invoice
- Click the button From e-PDF. Select the PDF-invoice with the electronic invoice. The values will be fetched
- Click the button From e-PDF. Select the PDF-invoice with the electronic invoice. The values will be fetched
In order for ZUGFeRD to work properly, a well-working system configuration is essential. Especially,
- Company: address
- Sales Taxes
- VAT numbers on customers and suppliers
To be able to download an ZUGFeRD-PDF, add this custom script.
frappe.ui.form.on('Sales Invoice', {
refresh: function(frm) {
frm.add_custom_button(__("Download e-PDF"), function()
{
generate_zugferd_pdf(frm);
});
}
});
function generate_zugferd_pdf(frm) {
var w = window.open(
frappe.urllib.get_full_url("/api/method/erpnextswiss.erpnextswiss.zugferd.zugferd.download_zugferd_pdf?"
+ "sales_invoice_name=" + encodeURIComponent(frm.doc.name)
));
if (!w) {
frappe.msgprint(__("Please enable pop-ups")); return;
}
}
The system will fall back to normal PDF generation, if anything with the factur-x module fails. In this case, check the Error Log. It will contain a record with the error.
In case some mandatory information is missing, the factur-x creation fails. Notably
- missing address
- missing payment terms
In case you observe The second argument of the method generate_facturx must be either a string, an etree.Element() object or a file (it is a <class 'bytes'>).
, you might be using an old version of factur-x. Please remove and install the current version using
$ cd /home/frappe/frappe-bench
$ env/bin/pip uninstall factur-x
$ env/bin/pip install factur-x