From bc370b3ee586d97c2fd5c9db74a0718d4fff2d10 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 28 Jan 2021 11:44:26 +0530 Subject: [PATCH 1/2] chore: Set Stock Entry Form Indicators in setup - Makes it easier to override via customisations - Style consistency with other forms that set indicator in setup as well --- .../stock/doctype/stock_entry/stock_entry.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index bd2fce8bef..cb6cab3341 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -5,6 +5,14 @@ frappe.provide("erpnext.accounts.dimensions"); frappe.ui.form.on('Stock Entry', { setup: function(frm) { + frm.set_indicator_formatter('item_code', function(doc) { + if (!doc.s_warehouse) { + return 'blue'; + } else { + return (doc.qty<=doc.actual_qty) ? 'green' : 'orange' + } + }); + frm.set_query('work_order', function() { return { filters: [ @@ -779,15 +787,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } } - this.frm.set_indicator_formatter('item_code', - function(doc) { - if (!doc.s_warehouse) { - return 'blue'; - } else { - return (doc.qty<=doc.actual_qty) ? "green" : "orange" - } - }) - this.frm.add_fetch("purchase_order", "supplier", "supplier"); frappe.dynamic_link = { doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier' } From 27bac2aaecfc831d899903f886a1feb3de357b91 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 28 Jan 2021 12:04:14 +0530 Subject: [PATCH 2/2] fix: Missing semi-colon --- erpnext/stock/doctype/stock_entry/stock_entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index cb6cab3341..bc1d089899 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -9,7 +9,7 @@ frappe.ui.form.on('Stock Entry', { if (!doc.s_warehouse) { return 'blue'; } else { - return (doc.qty<=doc.actual_qty) ? 'green' : 'orange' + return (doc.qty<=doc.actual_qty) ? 'green' : 'orange'; } });