Merge pull request #21261 from Alchez/dev-stock-available-order-desk
fix: [minor] show stock UOM in POS (develop)
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index df48783..f175687 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -1176,7 +1176,7 @@
return `
<div class="list-item indicator ${indicator_class}" data-item-code="${escape(item.item_code)}"
- data-batch-no="${batch_no}" title="Item: ${item.item_name} Available Qty: ${item.actual_qty}">
+ data-batch-no="${batch_no}" title="Item: ${item.item_name} Available Qty: ${item.actual_qty} ${item.stock_uom}">
<div class="item-name list-item__content list-item__content--flex-1.5 ellipsis">
${item.item_name}
</div>
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 17136e0..dfa0f7f 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -37,20 +37,33 @@
lft, rgt = frappe.db.get_value('Item Group', item_group, ['lft', 'rgt'])
# locate function is used to sort by closest match from the beginning of the value
-
result = []
- items_data = frappe.db.sql(""" SELECT name as item_code,
- item_name, image as item_image, idx as idx,is_stock_item
+ items_data = frappe.db.sql("""
+ SELECT
+ name AS item_code,
+ item_name,
+ stock_uom,
+ image AS item_image,
+ idx AS idx,
+ is_stock_item
FROM
`tabItem`
WHERE
- disabled = 0 and has_variants = 0 and is_sales_item = 1
- and item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
- and {condition} order by idx desc limit {start}, {page_length}"""
+ disabled = 0
+ AND has_variants = 0
+ AND is_sales_item = 1
+ AND item_group in (SELECT name FROM `tabItem Group` WHERE lft >= {lft} AND rgt <= {rgt})
+ AND {condition}
+ ORDER BY
+ idx desc
+ LIMIT
+ {start}, {page_length}"""
.format(
- start=start, page_length=page_length,
- lft=lft, rgt=rgt,
+ start=start,
+ page_length=page_length,
+ lft=lft,
+ rgt=rgt,
condition=condition
), as_dict=1)