mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-26 06:31:13 +01:00
* fix: reposting file attachment permission issue (#42068)
(cherry picked from commit 03e674e21d)
# Conflicts:
# erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json
* chore: fix conflicts
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -128,9 +128,7 @@ frappe.ui.form.on("Repost Item Valuation", {
|
|||||||
method: "restart_reposting",
|
method: "restart_reposting",
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
callback: function (r) {
|
callback: function (r) {
|
||||||
if (!r.exc) {
|
frm.reload_doc();
|
||||||
frm.refresh();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -218,13 +218,14 @@
|
|||||||
"fieldname": "reposting_data_file",
|
"fieldname": "reposting_data_file",
|
||||||
"fieldtype": "Attach",
|
"fieldtype": "Attach",
|
||||||
"label": "Reposting Data File",
|
"label": "Reposting Data File",
|
||||||
|
"no_copy": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-05-31 12:48:57.138693",
|
"modified": "2024-06-27 16:55:23.150146",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Repost Item Valuation",
|
"name": "Repost Item Valuation",
|
||||||
@@ -276,4 +277,4 @@
|
|||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"states": []
|
"states": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class RepostItemValuation(Document):
|
|||||||
def clear_attachment(self):
|
def clear_attachment(self):
|
||||||
if attachments := get_attachments(self.doctype, self.name):
|
if attachments := get_attachments(self.doctype, self.name):
|
||||||
attachment = attachments[0]
|
attachment = attachments[0]
|
||||||
frappe.delete_doc("File", attachment.name)
|
frappe.delete_doc("File", attachment.name, ignore_permissions=True)
|
||||||
|
|
||||||
if self.reposting_data_file:
|
if self.reposting_data_file:
|
||||||
self.db_set("reposting_data_file", None)
|
self.db_set("reposting_data_file", None)
|
||||||
@@ -219,6 +219,7 @@ class RepostItemValuation(Document):
|
|||||||
self.distinct_item_and_warehouse = None
|
self.distinct_item_and_warehouse = None
|
||||||
self.items_to_be_repost = None
|
self.items_to_be_repost = None
|
||||||
self.gl_reposting_index = 0
|
self.gl_reposting_index = 0
|
||||||
|
self.clear_attachment()
|
||||||
self.db_update()
|
self.db_update()
|
||||||
|
|
||||||
def deduplicate_similar_repost(self):
|
def deduplicate_similar_repost(self):
|
||||||
@@ -271,6 +272,7 @@ def repost(doc):
|
|||||||
repost_gl_entries(doc)
|
repost_gl_entries(doc)
|
||||||
|
|
||||||
doc.set_status("Completed")
|
doc.set_status("Completed")
|
||||||
|
doc.db_set("reposting_data_file", None)
|
||||||
remove_attached_file(doc.name)
|
remove_attached_file(doc.name)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -315,7 +317,7 @@ def remove_attached_file(docname):
|
|||||||
if file_name := frappe.db.get_value(
|
if file_name := frappe.db.get_value(
|
||||||
"File", {"attached_to_name": docname, "attached_to_doctype": "Repost Item Valuation"}, "name"
|
"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):
|
def repost_sl_entries(doc):
|
||||||
|
|||||||
Reference in New Issue
Block a user