Skip to content

Commit

Permalink
fix: bypass flag in Customer Group wasn't effective
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed May 3, 2023
1 parent 7e24215 commit f9a4972
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions erpnext/selling/doctype/customer/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f9a4972

Please sign in to comment.