From 180f406917f385ce5c01479bd5d4069387f2b952 Mon Sep 17 00:00:00 2001 From: Marc-Constantin Enke Date: Fri, 29 Aug 2025 11:07:37 +0200 Subject: [PATCH 1/3] fix: remove ignore_permissions (cherry picked from commit 7f55f421ab261d1dc94d9adad8640beaf3e1a198) --- erpnext/accounts/doctype/party_link/party_link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/party_link/party_link.py b/erpnext/accounts/doctype/party_link/party_link.py index d3148c3c455..c8c43f812cf 100644 --- a/erpnext/accounts/doctype/party_link/party_link.py +++ b/erpnext/accounts/doctype/party_link/party_link.py @@ -60,6 +60,6 @@ def create_party_link(primary_role, primary_party, secondary_party): party_link.secondary_role = "Customer" if primary_role == "Supplier" else "Supplier" party_link.secondary_party = secondary_party - party_link.save(ignore_permissions=True) + party_link.save() return party_link From 42b38b7998414985d8d1af08dbf4c66b09a063bc Mon Sep 17 00:00:00 2001 From: Marc-Constantin Enke Date: Fri, 29 Aug 2025 11:09:22 +0200 Subject: [PATCH 2/3] 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 () { From 646de0bec146904fbbbee9a9dbeb4547c6399b3a Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 8 Jul 2025 13:27:10 +0530 Subject: [PATCH 3/3] fix: duplicate items being created when fetching items from warehouse in stock reco (cherry picked from commit 73f6c2955934c2282739438ccdd2c1cc954f2407) --- .../doctype/stock_reconciliation/stock_reconciliation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index d1b81aa2ebe..59208725e7d 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -748,12 +748,12 @@ def get_items(warehouse, posting_date, posting_time, company, item_code=None, ig itemwise_batch_data = get_itemwise_batch(warehouse, posting_date, company, item_code) for d in items: - if d.item_code in itemwise_batch_data: + if (d.item_code, d.warehouse) in itemwise_batch_data: valuation_rate = get_stock_balance( d.item_code, d.warehouse, posting_date, posting_time, with_valuation_rate=True )[1] - for row in itemwise_batch_data.get(d.item_code): + for row in itemwise_batch_data.get((d.item_code, d.warehouse)): if ignore_empty_stock and not row.qty: continue @@ -885,7 +885,7 @@ def get_itemwise_batch(warehouse, posting_date, company, item_code=None): columns, data = execute(filters) for row in data: - itemwise_batch_data.setdefault(row[0], []).append( + itemwise_batch_data.setdefault((row[0], row[3]), []).append( frappe._dict( { "item_code": row[0],