diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index c1127c39cc04..32cb2bc05250 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -574,11 +574,19 @@ erpnext.PointOfSale.Controller = class { } else { if (!this.frm.doc.customer) return this.raise_customer_selection_alert(); - const { item_code, batch_no, serial_no, rate, uom } = item; + const { item_code, batch_no, serial_no, rate, uom, stock_uom } = item; if (!item_code) return; - const new_item = { item_code, batch_no, rate, uom, [field]: value }; + if (rate == undefined || rate == 0) { + frappe.show_alert({ + message: __("Price is not set for the item."), + indicator: "orange", + }); + frappe.utils.play_sound("error"); + return; + } + const new_item = { item_code, batch_no, rate, uom, [field]: value, stock_uom }; if (serial_no) { await this.check_serial_no_availablilty(item_code, this.frm.doc.set_warehouse, serial_no); diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js index 207a444218ba..9882c2d201ef 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_selector.js +++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js @@ -118,6 +118,7 @@ erpnext.PointOfSale.ItemSelector = class { data-item-code="${escape(item.item_code)}" data-serial-no="${escape(serial_no)}" data-batch-no="${escape(batch_no)}" data-uom="${escape(uom)}" data-rate="${escape(price_list_rate || 0)}" + data-stock-uom="${escape(item.stock_uom)}" title="${item.item_name}"> ${get_item_image_html()} @@ -251,17 +252,19 @@ erpnext.PointOfSale.ItemSelector = class { let serial_no = unescape($item.attr("data-serial-no")); let uom = unescape($item.attr("data-uom")); let rate = unescape($item.attr("data-rate")); + let stock_uom = unescape($item.attr("data-stock-uom")); // escape(undefined) returns "undefined" then unescape returns "undefined" batch_no = batch_no === "undefined" ? undefined : batch_no; serial_no = serial_no === "undefined" ? undefined : serial_no; uom = uom === "undefined" ? undefined : uom; rate = rate === "undefined" ? undefined : rate; + stock_uom = stock_uom === "undefined" ? undefined : stock_uom; me.events.item_selected({ field: "qty", value: "+1", - item: { item_code, batch_no, serial_no, uom, rate }, + item: { item_code, batch_no, serial_no, uom, rate, stock_uom }, }); me.search_field.set_focus(); });