reafctor: validate instead of postprocess
This commit is contained in:
parent
9016baddca
commit
938f7d2266
@ -2533,8 +2533,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",
|
||||
@ -2553,8 +2552,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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user