[minor] fetch supplier address, address_display on supplier trigger

This commit is contained in:
mbauskar 2017-04-13 11:38:57 +05:30
parent 2efe05c1ce
commit 1b32d913a2
3 changed files with 45 additions and 4 deletions

View File

@ -340,7 +340,8 @@ def make_stock_entry(purchase_order, item_code):
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]

View File

@ -229,6 +229,11 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
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 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
} 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 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
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);
}
});

View File

@ -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,
@ -1221,6 +1222,35 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"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,
@ -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",