From 91d269fe1aefd88987fd6f845ba5be4887fa4b38 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 4 Oct 2021 22:41:12 +0530 Subject: [PATCH] fix: set item uom as stock_uom if it isn't set (#27623) (#27780) * fix: set item uom as stock_uom if it isn't set (cherry picked from commit 5c372202d5fb024843fc1b13f843901f832532f7) Co-authored-by: Alan <2.alan.tom@gmail.com> --- erpnext/stock/doctype/stock_entry/stock_entry.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6d1df8fb599..dfd827b62d5 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -323,6 +323,12 @@ frappe.ui.form.on('Stock Entry', { attach_bom_items(frm.doc.bom_no) }, + before_save: function(frm) { + frm.doc.items.forEach((item) => { + item.uom = item.uom || item.stock_uom; + }) + }, + stock_entry_type: function(frm){ frm.remove_custom_button('Bill of Materials', "Get Items From"); frm.events.show_bom_custom_button(frm);