From 42b38b7998414985d8d1af08dbf4c66b09a063bc Mon Sep 17 00:00:00 2001 From: Marc-Constantin Enke Date: Fri, 29 Aug 2025 11:09:22 +0200 Subject: [PATCH] feat: add permission check for custom button (cherry picked from commit 00fd1d2f26f5f58649036edd4646038a730f9129) --- erpnext/buying/doctype/supplier/supplier.js | 5 ++++- erpnext/selling/doctype/customer/customer.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index c094dae10db..1a11b8b8f27 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -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 () { diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 0398ff6f062..3d9347a990d 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -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 () {