From a89b4f49fe9870065fee39a154b3a17e2d249f55 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 10 Jun 2024 17:14:27 +0530 Subject: [PATCH] fix: use invoice outstanding on Dunning (#41817) (cherry picked from commit cf0a29b05f9e120a7a1e648da50164a15c6b5b4e) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 68da9ea1657c..cb0803db932c 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -2678,6 +2678,10 @@ def postprocess_dunning(source, target): target.closing_text = letter_text.get("closing_text") target.language = letter_text.get("language") + # update outstanding + if source.payment_schedule and len(source.payment_schedule) == 1: + target.overdue_payments[0].outstanding = source.get("outstanding_amount") + target.validate() return get_mapped_doc(