Merge pull request #21261 from Alchez/dev-stock-available-order-desk

fix: [minor] show stock UOM in POS (develop)
This commit is contained in:
Deepesh Garg 2020-04-14 17:01:33 +05:30 committed by GitHub
commit 863d90b8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -1176,7 +1176,7 @@ class POSCart {
return ` return `
<div class="list-item indicator ${indicator_class}" data-item-code="${escape(item.item_code)}" <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"> <div class="item-name list-item__content list-item__content--flex-1.5 ellipsis">
${item.item_name} ${item.item_name}
</div> </div>

View File

@ -37,20 +37,33 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
lft, rgt = frappe.db.get_value('Item Group', item_group, ['lft', 'rgt']) 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 # locate function is used to sort by closest match from the beginning of the value
result = [] result = []
items_data = frappe.db.sql(""" SELECT name as item_code, items_data = frappe.db.sql("""
item_name, image as item_image, idx as idx,is_stock_item SELECT
name AS item_code,
item_name,
stock_uom,
image AS item_image,
idx AS idx,
is_stock_item
FROM FROM
`tabItem` `tabItem`
WHERE WHERE
disabled = 0 and has_variants = 0 and is_sales_item = 1 disabled = 0
and item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt}) AND has_variants = 0
and {condition} order by idx desc limit {start}, {page_length}""" 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( .format(
start=start, page_length=page_length, start=start,
lft=lft, rgt=rgt, page_length=page_length,
lft=lft,
rgt=rgt,
condition=condition condition=condition
), as_dict=1) ), as_dict=1)