diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js index 2491d99ee1428f187759c28b1838a011241ffde7..698faf86f0b1710d3d7e90ac0a3cb79e22e1f360 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js @@ -127,9 +127,7 @@ frappe.ui.form.on("Repost Item Valuation", { method: "restart_reposting", doc: frm.doc, callback: function (r) { - if (!r.exc) { - frm.refresh(); - } + frm.reload_doc(); }, }); }, diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json index eebde811f2f865bc8a83e0a35d5827c68a3c355d..25783876bcc88d0b7aac4ede21f2d4c9a94ba2d4 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json @@ -218,13 +218,14 @@ "fieldname": "reposting_data_file", "fieldtype": "Attach", "label": "Reposting Data File", + "no_copy": 1, "read_only": 1 } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-03-27 13:10:32.544839", + "modified": "2024-06-27 16:55:23.150146", "modified_by": "Administrator", "module": "Stock", "name": "Repost Item Valuation", 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 da13bf2e65cba895f0e727d71205c52dccc804e3..8967332fe03debfe90c28ab79a530bd5fbccacfa 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -143,7 +143,7 @@ class RepostItemValuation(Document): def clear_attachment(self): if attachments := get_attachments(self.doctype, self.name): attachment = attachments[0] - frappe.delete_doc("File", attachment.name) + frappe.delete_doc("File", attachment.name, ignore_permissions=True) if self.reposting_data_file: self.db_set("reposting_data_file", None) @@ -181,6 +181,7 @@ class RepostItemValuation(Document): self.distinct_item_and_warehouse = None self.items_to_be_repost = None self.gl_reposting_index = 0 + self.clear_attachment() self.db_update() def deduplicate_similar_repost(self): @@ -233,6 +234,7 @@ def repost(doc): repost_gl_entries(doc) doc.set_status("Completed") + doc.db_set("reposting_data_file", None) remove_attached_file(doc.name) except Exception as e: @@ -277,7 +279,7 @@ 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, delete_permanently=True) + frappe.delete_doc("File", file_name, ignore_permissions=True, delete_permanently=True) def repost_sl_entries(doc):