From 97cfc2bb85ef2fd384806418f28b5fc5a806130a Mon Sep 17 00:00:00 2001 From: Corentin Forler Date: Thu, 31 Jul 2025 16:33:37 +0200 Subject: [PATCH] fix(dunning): Round floats before running validate --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index ce48737d35..72bb04feb0 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -2820,6 +2820,13 @@ def create_dunning(source_name, target_doc=None, ignore_permissions=False): target.closing_text = letter_text.get("closing_text") target.language = letter_text.get("language") + # update outstanding from doc + if source.payment_schedule and len(source.payment_schedule) == 1: + for row in target.overdue_payments: + if row.payment_schedule == source.payment_schedule[0].name: + row.outstanding = source.get("outstanding_amount") + + target.round_floats_in(target) target.validate() return get_mapped_doc( -- GitLab