Merge pull request #58754 from frappe/mergify/bp/version-16-hotfix/pr-58740

fix: check material request price list permission (backport #58740)
This commit is contained in:
Sudharsanan Ashok
2026-09-04 13:07:14 +05:30
committed by GitHub

View File

@@ -101,8 +101,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);
}
},
});
}
}
},