show child table values in doclistview

This commit is contained in:
Anand Doshi 2012-06-29 18:09:04 +05:30
parent ebe23b0f89
commit e9a21cbb85

View File

@ -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'}}
]
});