Skip to content

Commit

Permalink
Merge pull request #35142 from ruthra-kumar/fix_bypass_check_in_custo…
Browse files Browse the repository at this point in the history
…mer_group

fix: ineffective bypass flag for Credit Limit in Customer Group
  • Loading branch information
ruthra-kumar authored May 8, 2023
2 parents 34a5f24 + f9a4972 commit 6315d9f
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 6315d9f

Please sign in to comment.