From 66722dfe69e13c3805f12dfaed4221442f0af050 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 29 Mar 2012 15:20:35 +0530 Subject: [PATCH] some buying listviews --- erpnext/buying/doctype/indent/listview.js | 33 +++++++++++++++++++ .../buying/doctype/purchase_order/listview.js | 33 +++++++++++++++++++ erpnext/buying/doctype/supplier/listview.js | 23 +++++++++++++ erpnext/stock/doctype/item/listview.js | 5 +-- 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 erpnext/buying/doctype/indent/listview.js create mode 100644 erpnext/buying/doctype/purchase_order/listview.js create mode 100644 erpnext/buying/doctype/supplier/listview.js diff --git a/erpnext/buying/doctype/indent/listview.js b/erpnext/buying/doctype/indent/listview.js new file mode 100644 index 0000000000..df78ea9bb7 --- /dev/null +++ b/erpnext/buying/doctype/indent/listview.js @@ -0,0 +1,33 @@ +// render +wn.doclistviews['Indent'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabIndent`.status", + "IFNULL(`tabIndent`.per_ordered, 0) as per_ordered", + "`tabIndent`.remark", + ]); + this.stats = this.stats.concat(['status', 'company']); + }, + + prepare_data: function(data) { + this._super(data); + if(['Stopped', 'Cancelled'].indexOf(data.status)!=-1) { + data.label_type = 'important'; + } else if(data.status == 'Submitted') { + data.label_type = 'success'; + } + + data.status_html = repl('%(status)s', data); + }, + + columns: [ + {width: '5%', content:'avatar'}, + {width: '3%', content:'docstatus'}, + {width: '17%', content:'name'}, + {width: '53%', content:'status_html+tags+remark', css: {'color': '#aaa'}}, + {width: '10%', content: 'per_ordered', type:'bar-graph', label:'Ordered'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); + diff --git a/erpnext/buying/doctype/purchase_order/listview.js b/erpnext/buying/doctype/purchase_order/listview.js new file mode 100644 index 0000000000..528fe60c9d --- /dev/null +++ b/erpnext/buying/doctype/purchase_order/listview.js @@ -0,0 +1,33 @@ +// render +wn.doclistviews['Purchase Order'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabPurchase Order`.supplier_name", + "ifnull(`tabPurchase Order`.per_received,0) as per_received", + "ifnull(`tabPurchase Order`.per_billed,0) as per_billed", + "`tabPurchase Order`.currency", + "ifnull(`tabPurchase Order`.grand_total_import,0) as grand_total_import" + ]); + this.stats = this.stats.concat(['status', 'company']); + }, + + columns: [ + {width: '5%', content:'avatar'}, + {width: '3%', content:'docstatus'}, + {width: '15%', content:'name'}, + {width: '35%', content:'tags+supplier_name', css: {color:'#aaa'}}, + { + width: '18%', + content: function(parent, data) { + $(parent).html(data.currency + ' ' + fmt_money(data.grand_total_import)) + }, + css: {'text-align':'right'} + }, + {width: '8%', content: 'per_received', type:'bar-graph', label:'Delivered'}, + {width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] + +}); + diff --git a/erpnext/buying/doctype/supplier/listview.js b/erpnext/buying/doctype/supplier/listview.js new file mode 100644 index 0000000000..86e22d6f63 --- /dev/null +++ b/erpnext/buying/doctype/supplier/listview.js @@ -0,0 +1,23 @@ +// render +wn.doclistviews['Supplier'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabSupplier`.supplier_type", + ]); + this.stats = this.stats.concat([]); + }, + + prepare_data: function(data) { + this._super(data); + }, + + columns: [ + {width: '5%', content:'avatar'}, + {width: '50%', content:'name'}, + {width: '10%', content:'tags'}, + {width: '23%', content:'supplier_type', css: {'color': '#aaa'}}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); + diff --git a/erpnext/stock/doctype/item/listview.js b/erpnext/stock/doctype/item/listview.js index af41abfdc9..7f0dbc8ae9 100644 --- a/erpnext/stock/doctype/item/listview.js +++ b/erpnext/stock/doctype/item/listview.js @@ -6,17 +6,18 @@ wn.doclistviews['Item'] = wn.views.ListView.extend({ "`tabItem`.item_name", "`tabItem`.description", ]); + this.stats = this.stats.concat(['default_warehouse', 'brand']); }, prepare_data: function(data) { this._super(data); - data.description = repl("[%(item_name)s] %(description)s", data); + data.description = repl("%(item_name)s | %(description)s", data); }, columns: [ {width: '5%', content:'avatar'}, {width: '20%', content:'name'}, - {width: '63%', content:'description', css: {'color': '#aaa'}}, + {width: '63%', content:'tags+description', css: {'color': '#aaa'}}, {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} ] });