From b6ec680c469d49812ad887cf2d3d8d746350615e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 22 Sep 2015 16:36:04 +0530 Subject: [PATCH] [fix] round percentages in get_indicator --- .../doctype/purchase_order/purchase_order_list.js | 8 ++++---- .../selling/doctype/sales_order/sales_order_list.js | 10 +++++----- .../doctype/material_request/material_request_list.js | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js index 0de5286d5e..7f0ab658ef 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js @@ -4,17 +4,17 @@ frappe.listview_settings['Purchase Order'] = { get_indicator: function(doc) { if(doc.status==="Stopped") { return [__("Stopped"), "darkgrey", "status,=,Stopped"]; - } else if(flt(doc.per_received) < 100 && doc.status!=="Stopped") { - if(flt(doc.per_billed) < 100) { + } else if(flt(doc.per_received, 2) < 100 && doc.status!=="Stopped") { + if(flt(doc.per_billed, 2) < 100) { return [__("To Receive and Bill"), "orange", "per_received,<,100|per_billed,<,100|status,!=,Stopped"]; } else { return [__("To Receive"), "orange", "per_received,<,100|per_billed,=,100|status,!=,Stopped"]; } - } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") { + } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") { return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"]; - } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") { + } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") { return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"]; } }, diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js index e4e67fc0d2..f51b7dc0b7 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_list.js +++ b/erpnext/selling/doctype/sales_order/sales_order_list.js @@ -4,14 +4,14 @@ frappe.listview_settings['Sales Order'] = { get_indicator: function(doc) { if(doc.status==="Stopped") { return [__("Stopped"), "darkgrey", "status,=,Stopped"]; - } else if(flt(doc.per_delivered) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { + } else if(flt(doc.per_delivered, 2) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { // to bill & overdue return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"]; - } else if(flt(doc.per_delivered) < 100 && doc.status!=="Stopped") { + } else if(flt(doc.per_delivered, 2) < 100 && doc.status!=="Stopped") { // not delivered - if(flt(doc.per_billed) < 100) { + if(flt(doc.per_billed, 2) < 100) { // not delivered & not billed return [__("To Deliver and Bill"), "orange", @@ -23,11 +23,11 @@ frappe.listview_settings['Sales Order'] = { "per_delivered,<,100|per_billed,=,100|status,!=,Stopped"]; } - } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") { + } else if(flt(doc.per_delivered, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") { // to bill return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"]; - } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") { + } else if(flt(doc.per_delivered, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") { return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"]; } diff --git a/erpnext/stock/doctype/material_request/material_request_list.js b/erpnext/stock/doctype/material_request/material_request_list.js index 390e22272f..6880aeae65 100644 --- a/erpnext/stock/doctype/material_request/material_request_list.js +++ b/erpnext/stock/doctype/material_request/material_request_list.js @@ -3,9 +3,9 @@ frappe.listview_settings['Material Request'] = { get_indicator: function(doc) { if(doc.status=="Stopped") { return [__("Stopped"), "red", "status,=,Stopped"]; - } else if(doc.docstatus==1 && flt(doc.per_ordered) < 100) { + } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) { return [__("Pending"), "orange", "per_ordered,<,100"]; - } else if(doc.docstatus==1 && flt(doc.per_ordered) == 100) { + } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 100) { if (doc.material_request_type == "Purchase") { return [__("Ordered"), "green", "per_ordered,=,100"]; } else if (doc.material_request_type == "Material Transfer") {