fix: customer credit limit check based on bypass_credit_limit_check in Journal Entry

(cherry picked from commit 8a84faebed)
This commit is contained in:
ljain112
2025-03-18 14:16:35 +05:30
committed by Mergify
parent 300f1a860b
commit 331ecc1964

View File

@@ -433,8 +433,22 @@ class JournalEntry(AccountsController):
if customers:
from erpnext.selling.doctype.customer.customer import check_credit_limit
customer_details = frappe._dict(
frappe.db.get_all(
"Customer Credit Limit",
filters={
"parent": ["in", customers],
"parenttype": ["=", "Customer"],
"company": ["=", self.company],
},
fields=["parent", "bypass_credit_limit_check"],
as_list=True,
)
)
for customer in customers:
check_credit_limit(customer, self.company)
ignore_outstanding_sales_order = bool(customer_details.get(customer))
check_credit_limit(customer, self.company, ignore_outstanding_sales_order)
def validate_cheque_info(self):
if self.voucher_type in ["Bank Entry"]: