From 9fdd37e1adcaef57cfa3fb55b373126694f4a016 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 30 May 2016 11:49:16 +0530 Subject: [PATCH] Fetch party info in Journal Entry on selection of reference Invoice --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 87942e5424..40386e088a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -728,8 +728,9 @@ def get_outstanding(args): amount_field: abs(against_jv_amount) } elif args.get("doctype") in ("Sales Invoice", "Purchase Invoice"): + party_type = "Customer" if args.get("doctype") == "Sales Invoice" else "Supplier" invoice = frappe.db.get_value(args["doctype"], args["docname"], - ["outstanding_amount", "conversion_rate"], as_dict=1) + ["outstanding_amount", "conversion_rate", scrub(party_type)], as_dict=1) exchange_rate = invoice.conversion_rate if (args.get("account_currency") != company_currency) else 1 @@ -742,7 +743,9 @@ def get_outstanding(args): return { amount_field: abs(flt(invoice.outstanding_amount)), - "exchange_rate": exchange_rate + "exchange_rate": exchange_rate, + "party_type": party_type, + "party": invoice.get(scrub(party_type)) } @frappe.whitelist()