fix: bypass flag in Customer Group wasn't effective

(cherry picked from commit f9a4972cb6)
This commit is contained in:
ruthra kumar
2023-05-03 16:40:38 +05:30
committed by Mergify
parent 7506132861
commit f0c9d89aab

View File

@@ -656,11 +656,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")