feat: add permission check for custom button

(cherry picked from commit 00fd1d2f26)
This commit is contained in:
Marc-Constantin Enke
2025-08-29 11:09:22 +02:00
committed by Mergify
parent 180f406917
commit 42b38b7998
2 changed files with 8 additions and 2 deletions

View File

@@ -113,7 +113,10 @@ frappe.ui.form.on("Supplier", {
__("Actions")
);
if (cint(frappe.defaults.get_default("enable_common_party_accounting"))) {
if (
cint(frappe.defaults.get_default("enable_common_party_accounting")) &&
frappe.model.can_create("Party Link")
) {
frm.add_custom_button(
__("Link with Customer"),
function () {

View File

@@ -156,7 +156,10 @@ frappe.ui.form.on("Customer", {
__("Actions")
);
if (cint(frappe.defaults.get_default("enable_common_party_accounting"))) {
if (
cint(frappe.defaults.get_default("enable_common_party_accounting")) &&
frappe.model.can_create("Party Link")
) {
frm.add_custom_button(
__("Link with Supplier"),
function () {