From 3ca897603760318b4e103ef6f0c8b29acb99e00f Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 8 May 2019 16:06:26 +0530 Subject: [PATCH] feat: add validation for fetching doc status --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 601813dc3b..c506090f32 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -978,7 +978,7 @@ def make_payment_order(source_name, target_doc=None): target_doc.bank_account = source_parent.bank_account target_doc.amount = source_parent.base_paid_amount target_doc.account = source_parent.paid_to - target_doc.payment_entry = source_doc.name + target_doc.payment_entry = source_parent.name target_doc.supplier = source_parent.party target_doc.mode_of_payment = source_parent.mode_of_payment @@ -986,9 +986,15 @@ def make_payment_order(source_name, target_doc=None): doclist = get_mapped_doc("Payment Entry", source_name, { "Payment Entry": { "doctype": "Payment Order", + "validation": { + "docstatus": ["=", 1] + } }, "Payment Entry Reference": { "doctype": "Payment Order Reference", + "validation": { + "docstatus": ["=", 1] + }, "postprocess": update_item },