commit
f32bae151f
@ -4,7 +4,7 @@ import frappe, json, os
|
|||||||
from frappe.utils import flt, cstr
|
from frappe.utils import flt, cstr
|
||||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils.file_manager import save_file, remove_file
|
from frappe.core.doctype.file.file import remove_file
|
||||||
from frappe.desk.form.load import get_attachments
|
from frappe.desk.form.load import get_attachments
|
||||||
from erpnext.regional.italy import state_codes
|
from erpnext.regional.italy import state_codes
|
||||||
|
|
||||||
@ -248,7 +248,16 @@ def prepare_and_attach_invoice(doc):
|
|||||||
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True)
|
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True)
|
||||||
|
|
||||||
xml_filename = progressive_name + ".xml"
|
xml_filename = progressive_name + ".xml"
|
||||||
save_file(xml_filename, invoice_xml, dt=doc.doctype, dn=doc.name, is_private=True)
|
|
||||||
|
_file = frappe.get_doc({
|
||||||
|
"doctype": "File",
|
||||||
|
"file_name": xml_filename,
|
||||||
|
"attached_to_doctype": doc.doctype,
|
||||||
|
"attached_to_name": doc.name,
|
||||||
|
"is_private": True,
|
||||||
|
"content": invoice_xml
|
||||||
|
})
|
||||||
|
_file.save()
|
||||||
|
|
||||||
#Delete e-invoice attachment on cancel.
|
#Delete e-invoice attachment on cancel.
|
||||||
def sales_invoice_on_cancel(doc, method):
|
def sales_invoice_on_cancel(doc, method):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user