From 2afcff185262439361d69581c5aee627bb5fcc80 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 15 Dec 2017 17:31:53 +0530 Subject: [PATCH] Get outstanding invoices on payment entry --- .../doctype/payment_entry/payment_entry.py | 18 ++++-- .../material_request_item.json | 60 +++++++++---------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 197f1af52c..72ebce21b0 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -508,13 +508,18 @@ def get_outstanding_reference_documents(args): # Get negative outstanding sales /purchase invoices negative_outstanding_invoices = [] - if args.get("party_type") not in ["Student", "Employee"]: + if args.get("party_type") not in ["Student", "Employee"] and not args.get("voucher_no"): negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"), args.get("party"), args.get("party_account"), party_account_currency, company_currency) # Get positive outstanding sales /purchase invoices/ Fees + condition = "" + if args.get("voucher_type") and args.get("voucher_no"): + condition = " and voucher_type='{0}' and voucher_no='{1}'"\ + .format(frappe.db.escape(args["voucher_type"]), frappe.db.escape(args["voucher_no"])) + outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"), - args.get("party_account")) + args.get("party_account"), condition=condition) for d in outstanding_invoices: d["exchange_rate"] = 1 @@ -803,8 +808,13 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= }) else: args = { - 'party_account': party_account, 'company': pe.company, 'party_type': pe.party_type, - 'party': pe.party, 'posting_date': pe.posting_date + 'party_account': party_account, + 'company': pe.company, + 'party_type': pe.party_type, + 'party': pe.party, + 'posting_date': pe.posting_date, + 'voucher_type': dt, + 'voucher_no': dn } references = get_outstanding_reference_documents(args=args) diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index 3434b4d48f..ef2e7fc8b4 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -357,34 +357,6 @@ "unique": 0, "width": "100px" }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "col_break2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -419,6 +391,34 @@ "unique": 0, "width": "100px" }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "col_break2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -898,8 +898,8 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-10-25 17:18:59.974778", - "modified_by": "Administrator", + "modified": "2017-12-15 16:29:18.902085", + "modified_by": "nabinhait@gmail.com", "module": "Stock", "name": "Material Request Item", "owner": "Administrator",