fix(accounts): render dunning letters after calculating totals

(cherry picked from commit f1ae497fde)
This commit is contained in:
pandiyan
2026-10-23 12:20:11 +05:30
parent 147ebef8ea
commit 3291ca4c19
@@ -3021,7 +3021,6 @@ def create_dunning(source_name, target_doc=None, ignore_permissions=False):
target.income_account = dunning_type.income_account
target.cost_center = dunning_type.cost_center
target.language = source.language
target.get_dunning_letter_text()
# update outstanding from doc
if source.payment_schedule and len(source.payment_schedule) == 1:
@@ -3030,6 +3029,8 @@ def create_dunning(source_name, target_doc=None, ignore_permissions=False):
row.outstanding = source.get("outstanding_amount")
target.validate()
if dunning_type:
target.get_dunning_letter_text()
return get_mapped_doc(
from_doctype="Sales Invoice",