From 135fe3405fad618b4a0dcae3d72a0f4824107c4f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 12 Jan 2015 16:10:42 +0530 Subject: [PATCH] [ui] listviews --- .../production_order/production_order.json | 8 ++-- .../production_order_list.html | 47 ------------------- .../production_order/production_order_list.js | 12 ++++- .../time_log_batch/time_log_batch.json | 6 +-- .../time_log_batch/time_log_batch_list.html | 15 ------ .../time_log_batch/time_log_batch_list.js | 5 +- erpnext/public/js/pos/pos.js | 2 +- erpnext/public/js/pos/pos_item.html | 2 +- erpnext/stock/doctype/item/item.json | 4 +- .../doctype/stock_entry/stock_entry_list.html | 24 ---------- .../doctype/stock_entry/stock_entry_list.js | 19 +++++++- .../maintenance_visit/maintenance_visit.json | 7 +-- .../maintenance_visit_list.html | 35 -------------- .../maintenance_visit_list.js | 8 ++++ .../doctype/newsletter/newsletter.json | 6 +-- .../doctype/newsletter/newsletter_list.html | 15 ------ .../doctype/newsletter/newsletter_list.js | 9 +++- 17 files changed, 67 insertions(+), 157 deletions(-) delete mode 100644 erpnext/manufacturing/doctype/production_order/production_order_list.html delete mode 100644 erpnext/projects/doctype/time_log_batch/time_log_batch_list.html delete mode 100644 erpnext/stock/doctype/stock_entry/stock_entry_list.html delete mode 100644 erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html delete mode 100644 erpnext/support/doctype/newsletter/newsletter_list.html diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index 6563952051..c6ef038ff7 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -27,7 +27,7 @@ "fieldname": "status", "fieldtype": "Select", "in_filter": 1, - "in_list_view": 1, + "in_list_view": 0, "label": "Status", "no_copy": 1, "oldfieldname": "status", @@ -56,7 +56,7 @@ "description": "Bill of Material to be considered for manufacturing", "fieldname": "bom_no", "fieldtype": "Link", - "in_list_view": 1, + "in_list_view": 0, "label": "BOM No", "oldfieldname": "bom_no", "oldfieldtype": "Link", @@ -77,7 +77,7 @@ "depends_on": "", "fieldname": "qty", "fieldtype": "Float", - "in_list_view": 1, + "in_list_view": 0, "label": "Qty To Manufacture", "oldfieldname": "qty", "oldfieldtype": "Currency", @@ -351,7 +351,7 @@ "idx": 1, "in_create": 0, "is_submittable": 1, - "modified": "2014-12-24 14:36:25.662920", + "modified": "2015-01-08 12:59:51.111895", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Order", diff --git a/erpnext/manufacturing/doctype/production_order/production_order_list.html b/erpnext/manufacturing/doctype/production_order/production_order_list.html deleted file mode 100644 index a856a0e5f1..0000000000 --- a/erpnext/manufacturing/doctype/production_order/production_order_list.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
-
- {% var per = 100 - cint((doc.qty - doc.produced_qty) * 100 / doc.qty); %} - {%= list.get_avatar_and_id(doc) %} - - - {%= doc.customer_name %} - {% if(per < 100 && doc.status!=="Stopped") { %} - {% if(frappe.datetime.get_diff(doc.expected_delivery_date) < 0) { %} - - {%= __("Overdue") %} - - {% } else { %} - - {%= doc.get_formatted("expected_delivery_date")%} - {% } %} - {% } %} - {% if(per == 100 && doc.status!=="Stopped") { %} - - - {% } %} - {% if(doc.status==="Stopped") { %} - {%= __("Stopped") %} - {% } %} - - {%= doc.sales_order %} - - {%= doc.bom_no %} -
-
-
- {% var completed = per, title = __("Completed") %} - {% include "templates/form_grid/includes/progress.html" %} -
-
diff --git a/erpnext/manufacturing/doctype/production_order/production_order_list.js b/erpnext/manufacturing/doctype/production_order/production_order_list.js index 457e803d15..b38581ba4f 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order_list.js +++ b/erpnext/manufacturing/doctype/production_order/production_order_list.js @@ -1,5 +1,15 @@ frappe.listview_settings['Production Order'] = { add_fields: ["bom_no", "status", "sales_order", "qty", "produced_qty", "expected_delivery_date"], - filters: [["status", "!=", "Completed"], ["status", "!=", "Stopped"]] + filters: [["status", "!=", "Completed"], ["status", "!=", "Stopped"]], + get_indicator: function(doc) { + return [__(doc.status), { + "Draft": "red", + "Submitted": "blue", + "Stopped": "red", + "In Process": "orange", + "Completed": "green", + "Cancelled": "darkgrey" + }[doc.status], "status,=," + doc.status]; + } }; diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.json b/erpnext/projects/doctype/time_log_batch/time_log_batch.json index 4418fcf754..9cf33f2da6 100644 --- a/erpnext/projects/doctype/time_log_batch/time_log_batch.json +++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.json @@ -30,7 +30,7 @@ "default": "Draft", "fieldname": "status", "fieldtype": "Select", - "in_list_view": 1, + "in_list_view": 0, "label": "Status", "options": "Draft\nSubmitted\nBilled\nCancelled", "permlevel": 0, @@ -40,7 +40,7 @@ "description": "Will be updated after Sales Invoice is Submitted.", "fieldname": "sales_invoice", "fieldtype": "Link", - "in_list_view": 1, + "in_list_view": 0, "label": "Sales Invoice", "options": "Sales Invoice", "permlevel": 0, @@ -83,7 +83,7 @@ "icon": "icon-time", "idx": 1, "is_submittable": 1, - "modified": "2014-12-24 16:48:03.419707", + "modified": "2015-01-08 12:06:19.123049", "modified_by": "Administrator", "module": "Projects", "name": "Time Log Batch", diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch_list.html b/erpnext/projects/doctype/time_log_batch/time_log_batch_list.html deleted file mode 100644 index 4a34f1cdb8..0000000000 --- a/erpnext/projects/doctype/time_log_batch/time_log_batch_list.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
-
- {%= list.get_avatar_and_id(doc) %} - - {%= doc.status %} - - ({%= doc.total_hours + " " + __("hours") %}) - -
-
-
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch_list.js b/erpnext/projects/doctype/time_log_batch/time_log_batch_list.js index cc6746e353..f4876b8b26 100644 --- a/erpnext/projects/doctype/time_log_batch/time_log_batch_list.js +++ b/erpnext/projects/doctype/time_log_batch/time_log_batch_list.js @@ -1,3 +1,6 @@ frappe.listview_settings['Time Log Batch'] = { - add_fields: ["status", "total_hours", "rate"] + add_fields: ["status", "total_hours", "rate"], + get_indicator: function(doc) { + return [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status]; + } }; diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js index 69501826ae..48a2b3708b 100644 --- a/erpnext/public/js/pos/pos.js +++ b/erpnext/public/js/pos/pos.js @@ -127,7 +127,7 @@ erpnext.pos.PointOfSale = Class.extend({ item_code: obj.name, item_price: format_currency(obj.price_list_rate, obj.currency), item_name: obj.name===obj.item_name ? "" : obj.item_name, - item_image: obj.image + item_image: obj.image ? "url('" + obj.image + "')" : null })).tooltip().appendTo($wrap); }); } diff --git a/erpnext/public/js/pos/pos_item.html b/erpnext/public/js/pos/pos_item.html index 481f041807..7f412d6665 100644 --- a/erpnext/public/js/pos/pos_item.html +++ b/erpnext/public/js/pos/pos_item.html @@ -1,6 +1,6 @@
+ style="{% if (item_image) { %} background-image: {%= item_image %} {% } %}">
{%= item_code %}
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 2fdb8e62fe..e12c764e77 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -133,7 +133,7 @@ }, { "fieldname": "image", - "fieldtype": "Image", + "fieldtype": "Attach", "label": "Image", "options": "", "permlevel": 0, @@ -877,7 +877,7 @@ "icon": "icon-tag", "idx": 1, "max_attachments": 1, - "modified": "2015-01-07 10:40:54.901356", + "modified": "2015-01-08 14:59:49.747106", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_list.html b/erpnext/stock/doctype/stock_entry/stock_entry_list.html deleted file mode 100644 index 92bf2fa7d1..0000000000 --- a/erpnext/stock/doctype/stock_entry/stock_entry_list.html +++ /dev/null @@ -1,24 +0,0 @@ -
-
-
- {%= list.get_avatar_and_id(doc) %} -
-
- -
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_list.js b/erpnext/stock/doctype/stock_entry/stock_entry_list.js index 9475ce09b0..7f1a7515f0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry_list.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry_list.js @@ -1,4 +1,21 @@ frappe.listview_settings['Stock Entry'] = { add_fields: ["`tabStock Entry`.`from_warehouse`", "`tabStock Entry`.`to_warehouse`", - "`tabStock Entry`.`purpose`", "`tabStock Entry`.`production_order`", "`tabStock Entry`.`bom_no`"] + "`tabStock Entry`.`purpose`", "`tabStock Entry`.`production_order`", "`tabStock Entry`.`bom_no`"], + column_render: { + "from_warehouse": function(doc) { + var html = ""; + if(doc.from_warehouse) { + html += ''+doc.from_warehouse+' '; + } + if(doc.from_warehouse || doc.to_warehouse) { + html += ' '; + } + if(doc.to_warehouse) { + html += ''+doc.to_warehouse+''; + } + return html; + } + } }; diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json index 6066a960f9..6934c29948 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json @@ -35,7 +35,7 @@ "fieldname": "customer_name", "fieldtype": "Data", "hidden": 1, - "in_list_view": 1, + "in_list_view": 0, "label": "Customer Name", "permlevel": 0, "read_only": 1 @@ -279,7 +279,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-01-01 14:30:02.998219", + "modified": "2015-01-08 14:02:17.403671", "modified_by": "Administrator", "module": "Support", "name": "Maintenance Visit", @@ -303,5 +303,6 @@ ], "search_fields": "status,maintenance_type,customer,customer_name,mntc_date,company,fiscal_year", "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "title_field": "customer_name" } \ No newline at end of file diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html deleted file mode 100644 index 2ddef7a974..0000000000 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.html +++ /dev/null @@ -1,35 +0,0 @@ -
-
-
- {%= list.get_avatar_and_id(doc) %} - - - - {%= doc.customer_name %} - - - {% var style = { - "Scheduled": "default", - "Unscheduled": "default", - "Breakdown": "danger" - }[doc.maintenance_type] %} - - {%= doc.maintenance_type %} - - {% var style = doc.completion_status==="Partially Completed" ? "warning" : "success" %} - - {%= doc.completion_status %} - -
-
- -
- {% var completed = doc.completed, title = __("Completed") %} - {% include "templates/form_grid/includes/progress.html" %} -
-
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js index 77f28d7ab3..e98979deb1 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit_list.js @@ -1,3 +1,11 @@ frappe.listview_settings['Maintenance Visit'] = { add_fields: ["customer", "customer_name", "completion_status", "maintenance_type"], + get_indicator: function(doc) { + var s = doc.completion_status || "Pending"; + return [__(s), { + "Pending": "blue", + "Partially Completed": "orange", + "Fully Completed": "green" + }[s], "completion_status,=," + doc.completion_status]; + } }; diff --git a/erpnext/support/doctype/newsletter/newsletter.json b/erpnext/support/doctype/newsletter/newsletter.json index a30dc418b6..007f20f666 100644 --- a/erpnext/support/doctype/newsletter/newsletter.json +++ b/erpnext/support/doctype/newsletter/newsletter.json @@ -81,7 +81,7 @@ { "fieldname": "subject", "fieldtype": "Small Text", - "in_list_view": 1, + "in_list_view": 0, "label": "Subject", "permlevel": 0, "reqd": 1 @@ -123,7 +123,7 @@ { "fieldname": "email_sent", "fieldtype": "Check", - "in_list_view": 1, + "in_list_view": 0, "label": "Email Sent?", "no_copy": 1, "permlevel": 0, @@ -132,7 +132,7 @@ ], "icon": "icon-envelope", "idx": 1, - "modified": "2014-08-04 07:22:06.445634", + "modified": "2015-01-08 10:45:54.106948", "modified_by": "Administrator", "module": "Support", "name": "Newsletter", diff --git a/erpnext/support/doctype/newsletter/newsletter_list.html b/erpnext/support/doctype/newsletter/newsletter_list.html deleted file mode 100644 index d9352c71d6..0000000000 --- a/erpnext/support/doctype/newsletter/newsletter_list.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
-
- {%= list.get_avatar_and_id(doc) %} -
-
- -
diff --git a/erpnext/support/doctype/newsletter/newsletter_list.js b/erpnext/support/doctype/newsletter/newsletter_list.js index 096b83e4e9..af64ad9201 100644 --- a/erpnext/support/doctype/newsletter/newsletter_list.js +++ b/erpnext/support/doctype/newsletter/newsletter_list.js @@ -1,3 +1,10 @@ frappe.listview_settings['Newsletter'] = { - add_fields: ["subject", "send_to_type", "email_sent"] + add_fields: ["subject", "send_to_type", "email_sent"], + get_indicator: function(doc) { + if(doc.email_sent) { + return [__("Sent"), "green", "email_sent,=,Yes"]; + } else { + return [__("Not Sent"), "orange", "email_sent,=,No"]; + } + } };