mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 20:48:27 +00:00
reafctor: validate instead of postprocess
This commit is contained in:
@@ -2049,8 +2049,7 @@ 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')
|
||||
|
||||
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",
|
||||
@@ -2069,8 +2068,7 @@ def create_dunning(source_name, target_doc=None, ignore_permissions=False):
|
||||
"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,
|
||||
|
||||
Reference in New Issue
Block a user