fix(selling): round only the final credit exposure

This commit is contained in:
Mihir Kandoi
2026-10-24 13:24:34 +05:30
committed by pandiyan
parent 1c19c646bf
commit ae6bc1264e
2 changed files with 5 additions and 5 deletions
+4 -1
View File
@@ -592,8 +592,11 @@ def check_credit_limit(customer, company, ignore_outstanding_sales_order=False,
customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order)
if extra_amount > 0:
customer_outstanding += flt(extra_amount)
customer_outstanding = flt(
customer_outstanding, frappe.get_precision("Customer Credit Limit", "credit_limit")
)
if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
if credit_limit > 0 and customer_outstanding > credit_limit:
message = _("Credit limit has been crossed for customer {0} ({1}/{2})").format(
customer, customer_outstanding, credit_limit
)
@@ -683,10 +683,7 @@ class DeliveryNote(SellingController):
if validate_against_credit_limit:
check_credit_limit(
self.customer,
self.company,
bypass_credit_limit_check_at_sales_order,
flt(extra_amount, self.precision("base_grand_total")),
self.customer, self.company, bypass_credit_limit_check_at_sales_order, extra_amount
)
def validate_packed_qty(self):