reafctor: validate instead of postprocess
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 0aa6eab..f240fe9 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -2533,8 +2533,7 @@
target.closing_text = letter_text.get('closing_text')
target.language = letter_text.get('language')
- def postprocess_overdue_payment(source, target, source_parent):
- target.overdue_days = (getdate(nowdate()) - getdate(source.due_date)).days
+ target.validate()
return get_mapped_doc(
from_doctype="Sales Invoice",
@@ -2553,8 +2552,7 @@
"name": "payment_schedule",
"parent": "sales_invoice"
},
- "condition": lambda doc: doc.outstanding > 0,
- "postprocess": postprocess_overdue_payment
+ "condition": lambda doc: doc.outstanding > 0
}
},
target_doc=target_doc,