show order type icon in sales order list view

This commit is contained in:
Anand Doshi
2012-07-13 16:46:12 +05:30
parent 255d58b3a0
commit 9ec8024db7
7 changed files with 152 additions and 120 deletions

View File

@@ -3,21 +3,23 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabSales Order`.customer_name",
"`tabSales Order`.customer_name",
"`tabSales Order`.status",
"`tabSales Order`.order_type",
"ifnull(`tabSales Order`.per_delivered,0) as per_delivered",
"ifnull(`tabSales Order`.per_billed,0) as per_billed",
"`tabSales Order`.currency",
"ifnull(`tabSales Order`.grand_total_export,0) as grand_total_export"
]);
this.stats = this.stats.concat(['status', 'company']);
this.stats = this.stats.concat(['status', 'order_type', 'company']);
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content:'avatar'},
{width: '3%', content:'docstatus'},
{width: '15%', content:'name'},
{width: '32%', content:'customer_name+tags', css: {color:'#222'}},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '29%', content: 'customer_name+tags', css: {color:'#222'}},
{
width: '18%',
content: function(parent, data) {
@@ -25,7 +27,19 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({
},
css: {'text-align':'right'}
},
{width: '8%', content: 'per_delivered', type:'bar-graph', label:'Delivered'},
{
width: '11%',
content: function(parent, data, me) {
var order_type = data.order_type.toLowerCase();
if (order_type === 'sales') {
me.render_icon(parent, 'icon-tag', data.order_type);
me.render_bar_graph(parent, data, 'per_billed', 'Delivered');
} else if (order_type === 'maintenance') {
me.render_icon(parent, 'icon-wrench', data.order_type);
}
},
},
{width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]