fix: remove file from the disk after the completion of reposting
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
index 4f45210..4878de8 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
@@ -281,6 +281,7 @@
repost_gl_entries(doc)
doc.set_status("Completed")
+ remove_attached_file(doc.name)
except Exception as e:
if frappe.flags.in_test:
@@ -309,6 +310,13 @@
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):
if doc.based_on == "Transaction":
repost_future_sle(