From 9bb4239dd5932b6534d0e009360f8cf348a5678d Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 25 Dec 2017 11:27:56 +0530 Subject: [PATCH] [fix] Shipping address not fetch from purchase order in to purchase invoice & receipt. (#4672) --- frappe/contacts/doctype/address/address.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/contacts/doctype/address/address.py b/frappe/contacts/doctype/address/address.py index 9cb099e5cb..2ec2f6504b 100644 --- a/frappe/contacts/doctype/address/address.py +++ b/frappe/contacts/doctype/address/address.py @@ -192,13 +192,17 @@ def get_address_templates(address): return result @frappe.whitelist() -def get_shipping_address(company): +def get_shipping_address(company, address = None): filters = [ ["Dynamic Link", "link_doctype", "=", "Company"], ["Dynamic Link", "link_name", "=", company], ["Address", "is_your_company_address", "=", 1] ] fields = ["name", "address_line1", "address_line2", "city", "state", "country"] + if address and frappe.db.get_value('Dynamic Link', + {'parent': address, 'link_name': company}): + filters.append(["Address", "name", "=", address]) + address = frappe.get_all("Address", filters=filters, fields=fields) or {} if address: