mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-16 21:42:11 +00:00
fix: add Stock UOM when adding new item in POS list (#44780)
This commit is contained in:
committed by
Abdeali Chharchhoda
parent
ca7c229e86
commit
96cc9e29a1
@@ -574,11 +574,19 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
} else {
|
} else {
|
||||||
if (!this.frm.doc.customer) return this.raise_customer_selection_alert();
|
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;
|
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) {
|
if (serial_no) {
|
||||||
await this.check_serial_no_availablilty(item_code, this.frm.doc.set_warehouse, serial_no);
|
await this.check_serial_no_availablilty(item_code, this.frm.doc.set_warehouse, serial_no);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
|||||||
data-item-code="${escape(item.item_code)}" data-serial-no="${escape(serial_no)}"
|
data-item-code="${escape(item.item_code)}" data-serial-no="${escape(serial_no)}"
|
||||||
data-batch-no="${escape(batch_no)}" data-uom="${escape(uom)}"
|
data-batch-no="${escape(batch_no)}" data-uom="${escape(uom)}"
|
||||||
data-rate="${escape(price_list_rate || 0)}"
|
data-rate="${escape(price_list_rate || 0)}"
|
||||||
|
data-stock-uom="${escape(item.stock_uom)}"
|
||||||
title="${item.item_name}">
|
title="${item.item_name}">
|
||||||
|
|
||||||
${get_item_image_html()}
|
${get_item_image_html()}
|
||||||
@@ -251,17 +252,19 @@ erpnext.PointOfSale.ItemSelector = class {
|
|||||||
let serial_no = unescape($item.attr("data-serial-no"));
|
let serial_no = unescape($item.attr("data-serial-no"));
|
||||||
let uom = unescape($item.attr("data-uom"));
|
let uom = unescape($item.attr("data-uom"));
|
||||||
let rate = unescape($item.attr("data-rate"));
|
let rate = unescape($item.attr("data-rate"));
|
||||||
|
let stock_uom = unescape($item.attr("data-stock-uom"));
|
||||||
|
|
||||||
// escape(undefined) returns "undefined" then unescape returns "undefined"
|
// escape(undefined) returns "undefined" then unescape returns "undefined"
|
||||||
batch_no = batch_no === "undefined" ? undefined : batch_no;
|
batch_no = batch_no === "undefined" ? undefined : batch_no;
|
||||||
serial_no = serial_no === "undefined" ? undefined : serial_no;
|
serial_no = serial_no === "undefined" ? undefined : serial_no;
|
||||||
uom = uom === "undefined" ? undefined : uom;
|
uom = uom === "undefined" ? undefined : uom;
|
||||||
rate = rate === "undefined" ? undefined : rate;
|
rate = rate === "undefined" ? undefined : rate;
|
||||||
|
stock_uom = stock_uom === "undefined" ? undefined : stock_uom;
|
||||||
|
|
||||||
me.events.item_selected({
|
me.events.item_selected({
|
||||||
field: "qty",
|
field: "qty",
|
||||||
value: "+1",
|
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();
|
me.search_field.set_focus();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user