Fetch party info in Journal Entry on selection of reference Invoice

This commit is contained in:
Nabin Hait 2016-05-30 11:49:16 +05:30
parent 5b7f6300c8
commit 9fdd37e1ad

View File

@ -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()