|
|
@@ -393,11 +393,17 @@ frappe.ui.form.Form = class FrappeForm { |
|
|
|
this.doc = frappe.get_doc(this.doctype, this.docname); |
|
|
|
|
|
|
|
// check permissions |
|
|
|
this.fetch_permissions(); |
|
|
|
if (!this.has_read_permission()) { |
|
|
|
frappe.show_not_permitted(__(this.doctype) + " " + __(cstr(this.docname))); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// update grids with new permissions |
|
|
|
this.grids.forEach((table) => { |
|
|
|
table.grid.refresh(); |
|
|
|
}); |
|
|
|
|
|
|
|
// read only (workflow) |
|
|
|
this.read_only = frappe.workflow.is_read_only(this.doctype, this.docname); |
|
|
|
if (this.read_only) this.set_read_only(true); |
|
|
@@ -1147,11 +1153,12 @@ frappe.ui.form.Form = class FrappeForm { |
|
|
|
.attr("target", "_blank"); |
|
|
|
} |
|
|
|
|
|
|
|
has_read_permission() { |
|
|
|
// get perm |
|
|
|
var dt = this.parent_doctype ? this.parent_doctype : this.doctype; |
|
|
|
fetch_permissions() { |
|
|
|
let dt = this.parent_doctype ? this.parent_doctype : this.doctype; |
|
|
|
this.perm = frappe.perm.get_perm(dt, this.doc); |
|
|
|
} |
|
|
|
|
|
|
|
has_read_permission() { |
|
|
|
if (!this.perm[0].read) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|