fix: customer credit limit validation on update (#30126)

(cherry picked from commit a0dc79332d)

Co-authored-by: Saqib Ansari <nextchamp.saqib@gmail.com>
This commit is contained in:
mergify[bot]
2022-03-09 17:49:34 +05:30
committed by GitHub
parent eb90d50946
commit e3387a06b6

View File

@@ -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))