From 2c4cd08844a45843b28107392fa8dba5dde937f7 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 21 May 2012 18:40:53 +0530 Subject: [PATCH] more listviews --- erpnext/projects/doctype/project/listview.js | 53 ++++++++++++++++ erpnext/projects/doctype/task/listview.js | 38 ++++++++++++ .../projects/doctype/timesheet/listview.js | 35 +++++++++++ erpnext/stock/doctype/batch/listview.js | 28 +++++++++ erpnext/stock/doctype/item/listview.js | 3 +- erpnext/stock/doctype/serial_no/listview.js | 28 +++++++++ erpnext/stock/doctype/warehouse/listview.js | 35 +++++++++++ erpnext/stock/doctype/warehouse/warehouse.txt | 32 +++++----- .../doctype/customer_issue/listview.js | 60 +++++++++++++++++++ .../doctype/maintenance_schedule/listview.js | 24 ++++++++ .../doctype/maintenance_visit/listview.js | 41 +++++++++++++ 11 files changed, 360 insertions(+), 17 deletions(-) create mode 100644 erpnext/projects/doctype/project/listview.js create mode 100644 erpnext/projects/doctype/task/listview.js create mode 100644 erpnext/projects/doctype/timesheet/listview.js create mode 100644 erpnext/stock/doctype/batch/listview.js create mode 100644 erpnext/stock/doctype/serial_no/listview.js create mode 100644 erpnext/stock/doctype/warehouse/listview.js create mode 100644 erpnext/support/doctype/customer_issue/listview.js create mode 100644 erpnext/support/doctype/maintenance_schedule/listview.js create mode 100644 erpnext/support/doctype/maintenance_visit/listview.js diff --git a/erpnext/projects/doctype/project/listview.js b/erpnext/projects/doctype/project/listview.js new file mode 100644 index 0000000000..0ed42cab49 --- /dev/null +++ b/erpnext/projects/doctype/project/listview.js @@ -0,0 +1,53 @@ +// render +wn.doclistviews['Project'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d); + this.fields = this.fields.concat([ + '`tabProject`.project_name', + '`tabProject`.status', + '`tabProject`.is_active', + '`tabProject`.priority', + 'IFNULL(`tabProject`.project_value, 0) as project_value', + 'IFNULL(`tabProject`.per_gross_margin, 0) as per_gross_margin', + '`tabProject`.completion_date', + ]); + //this.stats = this.stats.concat(['company']); + }, + + prepare_data: function(data) { + this._super(data); + data.completion_date = wn.datetime.str_to_user(data.completion_date); + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '3%', content: 'docstatus'}, + {width: '15%', content: 'name'}, + {width: '22%', content: 'project_name+tags'}, + { + width: '20%', + content: function(parent, data) { + $(parent).html(data.status + " [" + data.priority + "] " + + (data.is_active=='No'?" [Inactive]":"")); + }, + }, + { + width: '15%', + content: function(parent, data) { + $(parent).html(sys_defaults.currency + " " + + fmt_money(data.project_value)); + }, + css: {'text-align': 'right'}, + }, + { + width: '10%', + content: function(parent, data) { + $(parent).html(fmt_money(data.per_gross_margin) + " %"); + }, + css: {'text-align': 'right'}, + }, + {width: '12%', content:'completion_date', css: { + 'text-align': 'right', 'color':'#777' + }}, + ] +}); diff --git a/erpnext/projects/doctype/task/listview.js b/erpnext/projects/doctype/task/listview.js new file mode 100644 index 0000000000..468f1f3755 --- /dev/null +++ b/erpnext/projects/doctype/task/listview.js @@ -0,0 +1,38 @@ +// render +wn.doclistviews['Task'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d); + this.fields = this.fields.concat([ + '`tabTask`.subject', + '`tabTask`.status', + '`tabTask`.opening_date', + '`tabTask`.priority', + '`tabTask`.allocated_to', + ]); + }, + + prepare_data: function(data) { + this._super(data); + data.opening_date = wn.datetime.str_to_user(data.opening_date); + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '12%', content: 'name'}, + {width: '30%', content: 'subject+tags'}, + { + width: '15%', + content: function(parent, data) { + $(parent).html(data.status + + (data.priority ? " [" + data.priority + "]" : "") + ); + }, + }, + {width: '20%', content: 'allocated_to'}, + {width: '12%', content:'opening_date', css: { + 'text-align': 'right', 'color':'#777' + }}, + ] +}); diff --git a/erpnext/projects/doctype/timesheet/listview.js b/erpnext/projects/doctype/timesheet/listview.js new file mode 100644 index 0000000000..66e4e5d23c --- /dev/null +++ b/erpnext/projects/doctype/timesheet/listview.js @@ -0,0 +1,35 @@ +// render +wn.doclistviews['Timesheet'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d); + this.fields = this.fields.concat([ + '`tabTimesheet`.status', + '`tabTimesheet`.timesheet_date', + '`tabTimesheet`.owner', + '`tabTimesheet`.notes', + + ]); + }, + + prepare_data: function(data) { + this._super(data); + data.timesheet_date = wn.datetime.str_to_user(data.timesheet_date); + if(data.notes && data.notes.length > 50) { + data.notes = '' + + data.notes.substr(0,50) + '...'; + } + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '18%', content: 'name'}, + {width: '12%', content: 'status'}, + {width: '27%', content: 'notes+tags', css: {'color': '#777'}}, + {width: '20%', content: 'owner'}, + {width: '12%', content:'timesheet_date', css: { + 'text-align': 'right', 'color':'#777' + }}, + ] +}); diff --git a/erpnext/stock/doctype/batch/listview.js b/erpnext/stock/doctype/batch/listview.js new file mode 100644 index 0000000000..d8e19b3a5b --- /dev/null +++ b/erpnext/stock/doctype/batch/listview.js @@ -0,0 +1,28 @@ +// render +wn.doclistviews['Batch'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabBatch`.item", + "`tabBatch`.description", + ]); + this.stats = this.stats.concat(['company']); + }, + + prepare_data: function(data) { + this._super(data); + if(data.description && data.description.length > 50) { + data.description = '' + + data.description.substr(0,50) + '...'; + } + }, + + columns: [ + {width: '3%', content:'check'}, + {width: '5%', content:'avatar'}, + {width: '15%', content:'name'}, + {width: '15%', content:'item'}, + {width: '50%', content:'tags+description'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); \ No newline at end of file diff --git a/erpnext/stock/doctype/item/listview.js b/erpnext/stock/doctype/item/listview.js index a483e35cbc..28510ff467 100644 --- a/erpnext/stock/doctype/item/listview.js +++ b/erpnext/stock/doctype/item/listview.js @@ -13,7 +13,8 @@ wn.doclistviews['Item'] = wn.views.ListView.extend({ this._super(data); data.description = repl("%(item_name)s | %(description)s", data); if(data.description && data.description.length > 50) { - data.description = '' + data.description.substr(0,50) + '...'; + data.description = '' + + data.description.substr(0,50) + '...'; } }, diff --git a/erpnext/stock/doctype/serial_no/listview.js b/erpnext/stock/doctype/serial_no/listview.js new file mode 100644 index 0000000000..8d9a3e6e4e --- /dev/null +++ b/erpnext/stock/doctype/serial_no/listview.js @@ -0,0 +1,28 @@ +// render +wn.doclistviews['Serial No'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabSerial No`.item_code", + "`tabSerial No`.item_name", + "`tabSerial No`.status", + "`tabSerial No`.warehouse", + ]); + this.stats = this.stats.concat(['company']); + }, + + prepare_data: function(data) { + this._super(data); + data.item_name = data.item_name ? data.item_name : data.item_code; + }, + + columns: [ + {width: '3%', content:'check'}, + {width: '5%', content:'avatar'}, + {width: '15%', content:'name'}, + {width: '30%', content:'item_name+tags'}, + {width: '15%', content:'status'}, + {width: '20%', content:'warehouse', css: {'color': '#777'}}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); \ No newline at end of file diff --git a/erpnext/stock/doctype/warehouse/listview.js b/erpnext/stock/doctype/warehouse/listview.js new file mode 100644 index 0000000000..00b1e2e3a7 --- /dev/null +++ b/erpnext/stock/doctype/warehouse/listview.js @@ -0,0 +1,35 @@ +// render +wn.doclistviews['Warehouse'] = wn.views.ListView.extend({ + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabWarehouse`.warehouse_type", + "`tabWarehouse`.address_line_1", + "`tabWarehouse`.address_line_2", + "`tabWarehouse`.city", + "`tabWarehouse`.state", + "`tabWarehouse`.pin", + ]); + this.stats = this.stats.concat(['company']); + }, + + prepare_data: function(data) { + this._super(data); + var concat_list = []; + data.address_line_1 && concat_list.push(data.address_line_1); + data.address_line_2 && concat_list.push(data.address_line_2); + data.city && concat_list.push(data.city); + data.state && concat_list.push(data.state); + data.pin && concat_list.push(data.pin); + data.address = concat_list.join(", "); + }, + + columns: [ + {width: '3%', content:'check'}, + {width: '5%', content:'avatar'}, + {width: '20%', content:'name'}, + {width: '15%', content:'warehouse_type'}, + {width: '45%', content:'tags+address'}, + {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} + ] +}); \ No newline at end of file diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt index 2deacf0f61..16bf59d9d5 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.txt +++ b/erpnext/stock/doctype/warehouse/warehouse.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-11 13:18:57', + 'creation': '2012-05-15 12:15:13', 'docstatus': 0, - 'modified': '2012-04-11 17:47:35', + 'modified': '2012-05-21 18:02:46', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -25,7 +25,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 59 + 'version': 1 }, # These values are common for all DocField @@ -319,19 +319,6 @@ 'permlevel': 0 }, - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'state', - 'fieldtype': u'Select', - 'label': u'State', - 'oldfieldname': u'state', - 'oldfieldtype': u'Select', - 'options': u'\nSelect country first', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -344,6 +331,19 @@ 'reqd': 0 }, + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'state', + 'fieldtype': u'Data', + 'label': u'State', + 'oldfieldname': u'state', + 'oldfieldtype': u'Select', + 'options': u'Suggest', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/support/doctype/customer_issue/listview.js b/erpnext/support/doctype/customer_issue/listview.js new file mode 100644 index 0000000000..43e6125d95 --- /dev/null +++ b/erpnext/support/doctype/customer_issue/listview.js @@ -0,0 +1,60 @@ +// render +wn.doclistviews['Customer Issue'] = wn.views.ListView.extend({ + me: this, + + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabCustomer Issue`.customer", + "`tabCustomer Issue`.serial_no", + "`tabCustomer Issue`.item_name", + "`tabCustomer Issue`.complaint", + "`tabCustomer Issue`.status", + ]); + this.stats = this.stats.concat(['status', 'company']); + //this.show_hide_check_column(); + }, + + prepare_data: function(data) { + this._super(data); + if(data.status=='Open') { + data.label_type = 'important'; + } else if(data.status=='Closed') { + data.label_type = 'success'; + } else if(data.status=='Cancelled') { + data.label_type = 'info'; + } else if(data.status=='Work In Progress') { + data.label_type = 'info'; + data.status = 'WIP'; + } + + data.status_html = repl( + '%(status)s', data); + var a = $(data.status_html).click(function() { + me.set_filter('status', $(this).text()); + }); + + var concat_list = [data.customer]; + data.serial_no && concat_list.push(data.serial_no); + data.complaint && concat_list.push(data.complaint); + data.complaint = concat_list.join(" | "); + + // description + if(data.complaint && data.complaint.length > 50) { + data.complaint = '' + + data.complaint.substr(0,50) + '...'; + } + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '20%', content: 'name'}, + {width: '10%', content: 'status_html'}, + {width: '47%', content: 'tags+complaint', css: {color:'#777'}}, + {width: '12%', content: 'modified', + css: {'text-align': 'right', 'color':'#777'}} + ] + +}); diff --git a/erpnext/support/doctype/maintenance_schedule/listview.js b/erpnext/support/doctype/maintenance_schedule/listview.js new file mode 100644 index 0000000000..a471c3ebda --- /dev/null +++ b/erpnext/support/doctype/maintenance_schedule/listview.js @@ -0,0 +1,24 @@ +// render +wn.doclistviews['Maintenance Schedule'] = wn.views.ListView.extend({ + me: this, + + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabMaintenance Schedule`.customer", + ]); + this.stats = this.stats.concat(['company']); + //this.show_hide_check_column(); + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '20%', content: 'name'}, + {width: '55%', content: 'customer+tags'}, + {width: '14%', content: 'modified', + css: {'text-align': 'right', 'color':'#777'}} + ] + +}); diff --git a/erpnext/support/doctype/maintenance_visit/listview.js b/erpnext/support/doctype/maintenance_visit/listview.js new file mode 100644 index 0000000000..654f455fd0 --- /dev/null +++ b/erpnext/support/doctype/maintenance_visit/listview.js @@ -0,0 +1,41 @@ +// render +wn.doclistviews['Maintenance Visit'] = wn.views.ListView.extend({ + me: this, + + init: function(d) { + this._super(d) + this.fields = this.fields.concat([ + "`tabMaintenance Visit`.customer_name", + "`tabMaintenance Visit`.mntc_date", + "`tabMaintenance Visit`.mntc_time", + "`tabMaintenance Visit`.maintenance_type", + "`tabMaintenance Visit`.completion_status", + + ]); + this.stats = this.stats.concat(['completion_status', 'company']); + //this.show_hide_check_column(); + }, + + prepare_data: function(data) { + this._super(data); + data.mntc_date = wn.datetime.str_to_user(data.mntc_date); + data.mntc_time = wn.datetime.time_to_ampm(data.mntc_time); + data.date_time = "on " + data.mntc_date + " at " + + data.mntc_time[0] + ":" + data.mntc_time[1] + " " + data.mntc_time[2]; + data.customer_name = data.customer_name + " " + data.date_time; + data.completion_status = data.completion_status + + (data.maintenance_type ? " [" + data.maintenance_type + "]": ""); + }, + + columns: [ + {width: '3%', content: 'check'}, + {width: '5%', content: 'avatar'}, + {width: '3%', content: 'docstatus'}, + {width: '15%', content: 'name'}, + {width: '40%', content: 'customer_name+tags'}, + {width: '20%', content: 'completion_status'}, + {width: '14%', content: 'modified', + css: {'text-align': 'right', 'color':'#777'}} + ] + +});