From e3387a06b61c9775b5cd522d4aea847e6b8ca135 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Mar 2022 17:49:34 +0530 Subject: [PATCH] fix: customer credit limit validation on update (#30126) (cherry picked from commit a0dc79332df5b2a567a13a0b052bfc9bdf4e3153) Co-authored-by: Saqib Ansari --- erpnext/selling/doctype/customer/customer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index df871491422..c78227e4c86 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -219,7 +219,9 @@ class Customer(TransactionBase): else: company_record.append(limit.company) - outstanding_amt = get_customer_outstanding(self.name, limit.company) + outstanding_amt = get_customer_outstanding( + self.name, limit.company, ignore_outstanding_sales_order=limit.bypass_credit_limit_check + ) if flt(limit.credit_limit) < outstanding_amt: frappe.throw(_("""New credit limit is less than current outstanding amount for the customer. Credit limit has to be atleast {0}""").format(outstanding_amt))