From 92669eae66815707299fef022132b5eb95129534 Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Wed, 17 Jul 2019 13:03:29 +0530 Subject: [PATCH] fix(stock): batch list view statuses --- erpnext/stock/doctype/batch/batch_list.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch_list.js b/erpnext/stock/doctype/batch/batch_list.js index 08ad9bc6733..05bf37f0f4a 100644 --- a/erpnext/stock/doctype/batch/batch_list.js +++ b/erpnext/stock/doctype/batch/batch_list.js @@ -1,18 +1,14 @@ frappe.listview_settings['Batch'] = { - add_fields: ["item", "expiry_date", "batch_qty"], - get_indicator: function (doc) { - if (!doc.batch_qty) { - return ["Empty", "darkgrey", "batch_qty,=,0"]; + add_fields: ["item", "expiry_date", "batch_qty", "disabled"], + get_indicator: (doc) => { + if (doc.disabled) { + return [__("Disabled"), "darkgrey", "disabled,=,1"]; + } else if (doc.expiry_date && frappe.datetime.get_diff(doc.expiry_date, frappe.datetime.nowdate()) <= 0) { + return [__("Expired"), "red", "expiry_date,not in,|expiry_date,<=,Today|batch_qty,>,0|disabled,=,0"] + } else if (!doc.batch_qty) { + return [__("Empty"), "darkgrey", "batch_qty,=,0|disabled,=,0"]; } else { - if (doc.expiry_date) { - if (frappe.datetime.get_diff(doc.expiry_date, frappe.datetime.nowdate()) <= 0) { - return [__("Expired"), "red", "expiry_date,>=,Today|batch_qty,>,0"] - } else { - return [__("Not Expired"), "green", "expiry_date,<,Today|batch_qty,>,0"] - } - } else { - return ["Active", "green", "batch_qty,>,0"]; - }; + return [__("Active"), "green", "batch_qty,>,0|disabled,=,0"]; }; } };