From e9a21cbb85f452b46d86ec13ace7ffff274eab76 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 29 Jun 2012 18:09:04 +0530 Subject: [PATCH] show child table values in doclistview --- .../stock/doctype/purchase_receipt/listview.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/listview.js b/erpnext/stock/doctype/purchase_receipt/listview.js index c1b8b42f75..915565723b 100644 --- a/erpnext/stock/doctype/purchase_receipt/listview.js +++ b/erpnext/stock/doctype/purchase_receipt/listview.js @@ -4,16 +4,27 @@ wn.doclistviews['Purchase Receipt'] = wn.views.ListView.extend({ this._super(d); this.fields = this.fields.concat([ "`tabPurchase Receipt`.supplier_name", - "`tabPurchase Receipt`.purchase_order_no" + "group_concat(`tabPurchase Receipt Item`.prevdoc_docname) as purchase_order_no", ]); }, + prepare_data: function(data) { + this._super(data); + if(data.purchase_order_no) { + data.purchase_order_no = data.purchase_order_no.split(","); + var po_list = []; + $.each(data.purchase_order_no, function(i, v){ + if(po_list.indexOf(v)==-1) po_list.push(v); + }); + data.purchase_order_no = po_list.join(", "); + } + }, columns: [ {width: '3%', content: 'check'}, {width: '5%', content:'avatar'}, {width: '3%', content:'docstatus'}, {width: '15%', content:'name'}, - {width: '47%', content:'supplier_name+tags', css: {color:'#222'}}, - {width: '15%', content:'purchase_order_no', type:'link', doctype:'Purchase Order'}, + {width: '32%', content:'supplier_name+tags', css: {color:'#222'}}, + {width: '30%', content:'purchase_order_no'}, {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} ] });