[minor] fetch supplier address, address_display on supplier trigger
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 96351e3..88e7d20 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -340,7 +340,8 @@
stock_entry.purchase_order = purchase_order.name
stock_entry.supplier = purchase_order.supplier
stock_entry.supplier_name = purchase_order.supplier_name
- stock_entry.supplier_address = purchase_order.address_display
+ stock_entry.supplier_address = purchase_order.supplier_address
+ stock_entry.address_display = purchase_order.address_display
stock_entry.company = purchase_order.company
stock_entry.from_bom = 1
po_item = [d for d in purchase_order.items if d.item_code == item_code][0]
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 864f9b1..3777f89 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -229,6 +229,11 @@
this.frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.actual_qty) ? "green" : "orange" })
+ this.frm.add_fetch("purchase_order", "supplier", "supplier");
+ this.frm.add_fetch("supplier", "supplier_name", "supplier_name");
+
+ frappe.dynamic_link = { doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier' }
+ this.frm.set_query("supplier_address", erpnext.queries.address_query)
},
onload_post_render: function() {
@@ -509,7 +514,8 @@
} else {
doc.customer = doc.customer_name = doc.customer_address =
doc.delivery_note_no = doc.sales_invoice_no = doc.supplier =
- doc.supplier_name = doc.supplier_address = doc.purchase_receipt_no = null;
+ doc.supplier_name = doc.supplier_address = doc.purchase_receipt_no =
+ doc.address_display = null;
}
if(doc.purpose == "Material Receipt") {
this.frm.set_value("from_bom", 0);
@@ -520,5 +526,9 @@
doc.purpose!='Material Issue');
this.frm.fields_dict["items"].grid.set_column_disp("additional_cost", doc.purpose!='Material Issue');
+ },
+
+ supplier: function(doc) {
+ erpnext.utils.get_party_details(this.frm, null, null, null);
}
});
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index b33c6b4..46da563 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -1197,7 +1197,7 @@
"columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_address",
- "fieldtype": "Small Text",
+ "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1210,6 +1210,7 @@
"no_copy": 1,
"oldfieldname": "supplier_address",
"oldfieldtype": "Small Text",
+ "options": "Address",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -1226,6 +1227,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "address_display",
+ "fieldtype": "Small Text",
+ "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,
+ "label": "Address",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1654,7 +1684,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-04-10 12:01:40.888115",
+ "modified": "2017-04-13 11:55:06.828073",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",