From 26bb6f37bc504504b78d9c3d42d2cbbe8a17a851 Mon Sep 17 00:00:00 2001 From: shreyas Date: Mon, 1 Feb 2016 15:32:32 +0530 Subject: [PATCH] [Partial] Fix to add Shipping address in Purchase order --- erpnext/buying/doctype/purchase_order/purchase_order.js | 6 ++++++ erpnext/utilities/doctype/address/address.py | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 05beb6e53b6..408adfb2dc1 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -13,6 +13,12 @@ frappe.ui.form.on("Purchase Order", { } }); +frappe.ui.form.on_change("Purchase Order", "company", function(frm){ + erpnext.utils.get_shipping_address(frm.doc) + } +); + + erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({ refresh: function(doc, cdt, cdn) { var me = this; diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py index 83ec775a9ac..5a6d1efea59 100644 --- a/erpnext/utilities/doctype/address/address.py +++ b/erpnext/utilities/doctype/address/address.py @@ -144,7 +144,6 @@ def get_address_templates(address): else: return name, template - @frappe.whitelist() def get_shipping_address(company): filters = {"company": company, "is_company_address":1} @@ -156,5 +155,4 @@ def get_shipping_address(company): frappe.throw(_("Please add addresses for the company")) else: name, address_template = get_address_templates(address_as_dict) - return address_as_dict.get("name"), frappe.render_template(address_template, address_as_dict)