mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 15:29:30 +00:00
fix: check material request price list permission (#58740)
(cherry picked from commit 0b1f1d6851)
This commit is contained in:
@@ -93,8 +93,27 @@ frappe.ui.form.on("Material Request", {
|
||||
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
||||
if (!frm.doc.buying_price_list) {
|
||||
const buying_price_list = frappe.defaults.get_default("buying_price_list");
|
||||
if (frappe.has_permission("Price List", "read", buying_price_list)) {
|
||||
frm.set_value("buying_price_list", buying_price_list);
|
||||
if (buying_price_list) {
|
||||
const docname = frm.doc.name;
|
||||
frappe.call({
|
||||
type: "GET",
|
||||
method: "frappe.client.has_permission",
|
||||
no_spinner: true,
|
||||
args: {
|
||||
doctype: "Price List",
|
||||
docname: buying_price_list,
|
||||
perm_type: "read",
|
||||
},
|
||||
callback: ({ message }) => {
|
||||
if (
|
||||
message?.has_permission &&
|
||||
frm.doc.name === docname &&
|
||||
!frm.doc.buying_price_list
|
||||
) {
|
||||
frm.set_value("buying_price_list", buying_price_list);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user