Browse Source

fix: file api

develop
Saurabh 6 years ago
parent
commit
acf83791ab
  1. 13
      erpnext/regional/italy/utils.py

13
erpnext/regional/italy/utils.py

@ -4,7 +4,7 @@ import frappe, json, os
from frappe.utils import flt, cstr
from erpnext.controllers.taxes_and_totals import get_itemised_tax
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 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)
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.
def sales_invoice_on_cancel(doc, method):

Loading…
Cancel
Save