From f9a4972cb621985dcd5e17460627931db0877e8a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 3 May 2023 16:40:38 +0530 Subject: [PATCH] fix: bypass flag in Customer Group wasn't effective --- erpnext/selling/doctype/customer/customer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 18336d2c9f48..f15ac1257b29 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -617,11 +617,15 @@ def get_credit_limit(customer, company): if not credit_limit: customer_group = frappe.get_cached_value("Customer", customer, "customer_group") - credit_limit = frappe.db.get_value( + + result = frappe.db.get_values( "Customer Credit Limit", {"parent": customer_group, "parenttype": "Customer Group", "company": company}, - "credit_limit", + fieldname=["credit_limit", "bypass_credit_limit_check"], + as_dict=True, ) + if result and not result[0].bypass_credit_limit_check: + credit_limit = result[0].credit_limit if not credit_limit: credit_limit = frappe.get_cached_value("Company", company, "credit_limit")