mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
fix: cannot change customer fields if credit exhausted (#22838)
* fix: cannot change customer fields if credit exhausted * fix: order based on company * fix: sort current limits w.r.t company before compare * fix: CustomerCreditLimit Object is not subscriptable
This commit is contained in:
@@ -182,6 +182,14 @@ class Customer(TransactionBase):
|
|||||||
if self.get("__islocal") or not self.credit_limits:
|
if self.get("__islocal") or not self.credit_limits:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
past_credit_limits = [d.credit_limit
|
||||||
|
for d in frappe.db.get_all("Customer Credit Limit", filters={'parent': self.name}, fields=["credit_limit"], order_by="company")]
|
||||||
|
|
||||||
|
current_credit_limits = [d.credit_limit for d in sorted(self.credit_limits, key=lambda k: k.company)]
|
||||||
|
|
||||||
|
if past_credit_limits == current_credit_limits:
|
||||||
|
return
|
||||||
|
|
||||||
company_record = []
|
company_record = []
|
||||||
for limit in self.credit_limits:
|
for limit in self.credit_limits:
|
||||||
if limit.company in company_record:
|
if limit.company in company_record:
|
||||||
|
|||||||
Reference in New Issue
Block a user