mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-07 04:24:13 +00:00
fix: remove file from the disk after the completion of reposting
(cherry picked from commit fb330d1b5a)
This commit is contained in:
committed by
Mergify
parent
faf79f4d2a
commit
b582e9c42c
@@ -286,6 +286,7 @@ def repost(doc):
|
|||||||
repost_gl_entries(doc)
|
repost_gl_entries(doc)
|
||||||
|
|
||||||
doc.set_status("Completed")
|
doc.set_status("Completed")
|
||||||
|
remove_attached_file(doc.name)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if frappe.flags.in_test:
|
if frappe.flags.in_test:
|
||||||
@@ -314,6 +315,13 @@ def repost(doc):
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_attached_file(docname):
|
||||||
|
if file_name := frappe.db.get_value(
|
||||||
|
"File", {"attached_to_name": docname, "attached_to_doctype": "Repost Item Valuation"}, "name"
|
||||||
|
):
|
||||||
|
frappe.delete_doc("File", file_name)
|
||||||
|
|
||||||
|
|
||||||
def repost_sl_entries(doc):
|
def repost_sl_entries(doc):
|
||||||
if doc.based_on == "Transaction":
|
if doc.based_on == "Transaction":
|
||||||
repost_future_sle(
|
repost_future_sle(
|
||||||
|
|||||||
Reference in New Issue
Block a user