fix: check if attached doctype exists (#30911)
* fix: return False if attached doctype is not found * fix(UX): add a open url button in file form * fix(typo): add translate to string * fix: check if it is absolute url * fix: return false via module not found error
This commit is contained in:
parent
68fc629389
commit
2372fd8c02
2 changed files with 7 additions and 0 deletions
|
|
@ -1,5 +1,10 @@
|
|||
frappe.ui.form.on("File", {
|
||||
refresh: function (frm) {
|
||||
frm.add_custom_button(__("View File"), () => {
|
||||
if (!frappe.utils.is_url(frm.doc.file_url)) {
|
||||
window.open(window.location.origin + frm.doc.file_url);
|
||||
}
|
||||
});
|
||||
if (!frm.doc.is_folder) {
|
||||
// add download button
|
||||
frm.add_custom_button(__("Download"), () => frm.trigger("download"), "fa fa-download");
|
||||
|
|
|
|||
|
|
@ -818,6 +818,8 @@ def has_permission(doc, ptype=None, user=None, debug=False):
|
|||
|
||||
try:
|
||||
ref_doc = frappe.get_doc(attached_to_doctype, attached_to_name)
|
||||
except ModuleNotFoundError:
|
||||
return False
|
||||
except frappe.DoesNotExistError:
|
||||
frappe.clear_last_message()
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue