Merge pull request #41708 from Mutantpenguin/patch-1
refactor: use doctype File directly instead of save_file from file_manager.py
This commit is contained in:
@@ -12,7 +12,6 @@ from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import flt, get_datetime_str, today
|
||||
from frappe.utils.data import format_datetime
|
||||
from frappe.utils.file_manager import save_file
|
||||
|
||||
import erpnext
|
||||
|
||||
@@ -101,16 +100,15 @@ class ImportSupplierInvoice(Document):
|
||||
self.file_count += 1
|
||||
if pi_name:
|
||||
self.purchase_invoices_count += 1
|
||||
save_file(
|
||||
file_name,
|
||||
encoded_content,
|
||||
"Purchase Invoice",
|
||||
pi_name,
|
||||
folder=None,
|
||||
decode=False,
|
||||
is_private=0,
|
||||
df=None,
|
||||
)
|
||||
|
||||
file_doc = frappe.new_doc("File")
|
||||
file_doc.file_name = file_name
|
||||
file_doc.attached_to_doctype = "Purchase Invoice"
|
||||
file_doc.attached_to_name = pi_name
|
||||
file_doc.content = encoded_content
|
||||
file_doc.decode = False
|
||||
file_doc.is_private = False
|
||||
file_doc.insert(ignore_permissions=True)
|
||||
|
||||
def prepare_items_for_invoice(self, file_content, invoices_args):
|
||||
qty = 1
|
||||
|
||||
Reference in New Issue
Block a user