mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
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.model.document import Document
|
||||||
from frappe.utils import flt, get_datetime_str, today
|
from frappe.utils import flt, get_datetime_str, today
|
||||||
from frappe.utils.data import format_datetime
|
from frappe.utils.data import format_datetime
|
||||||
from frappe.utils.file_manager import save_file
|
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
|
|
||||||
@@ -101,16 +100,15 @@ class ImportSupplierInvoice(Document):
|
|||||||
self.file_count += 1
|
self.file_count += 1
|
||||||
if pi_name:
|
if pi_name:
|
||||||
self.purchase_invoices_count += 1
|
self.purchase_invoices_count += 1
|
||||||
save_file(
|
|
||||||
file_name,
|
file_doc = frappe.new_doc("File")
|
||||||
encoded_content,
|
file_doc.file_name = file_name
|
||||||
"Purchase Invoice",
|
file_doc.attached_to_doctype = "Purchase Invoice"
|
||||||
pi_name,
|
file_doc.attached_to_name = pi_name
|
||||||
folder=None,
|
file_doc.content = encoded_content
|
||||||
decode=False,
|
file_doc.decode = False
|
||||||
is_private=0,
|
file_doc.is_private = False
|
||||||
df=None,
|
file_doc.insert(ignore_permissions=True)
|
||||||
)
|
|
||||||
|
|
||||||
def prepare_items_for_invoice(self, file_content, invoices_args):
|
def prepare_items_for_invoice(self, file_content, invoices_args):
|
||||||
qty = 1
|
qty = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user