Merge pull request #17200 from Anurag810/pos_running

fix: order by idx(v11)
This commit is contained in:
rohitwaghchaure 2019-04-11 10:57:05 +05:30 committed by GitHub
commit 4898d1936b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
if display_items_in_stock == 0: if display_items_in_stock == 0:
res = frappe.db.sql("""select i.name as item_code, i.item_name, i.image as item_image, res = frappe.db.sql("""select i.name as item_code, i.item_name, i.image as item_image, i.idx as idx,
i.is_stock_item, item_det.price_list_rate, item_det.currency i.is_stock_item, item_det.price_list_rate, item_det.currency
from `tabItem` i LEFT JOIN from `tabItem` i LEFT JOIN
(select item_code, price_list_rate, currency from (select item_code, price_list_rate, currency from
@ -49,7 +49,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
where where
i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1 i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt}) and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
and {condition} limit {start}, {page_length}""".format(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition), and {condition} order by idx desc limit {start}, {page_length}""".format(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
{ {
'item_code': item_code, 'item_code': item_code,
'price_list': price_list 'price_list': price_list
@ -60,7 +60,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
} }
elif display_items_in_stock == 1: elif display_items_in_stock == 1:
query = """select i.name as item_code, i.item_name, i.image as item_image, query = """select i.name as item_code, i.item_name, i.image as item_image, i.idx as idx,
i.is_stock_item, item_det.price_list_rate, item_det.currency i.is_stock_item, item_det.price_list_rate, item_det.currency
from `tabItem` i LEFT JOIN from `tabItem` i LEFT JOIN
(select item_code, price_list_rate, currency from (select item_code, price_list_rate, currency from
@ -79,7 +79,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
where where
i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1 i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt}) and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
and {condition} limit {start}, {page_length}""".format and {condition} order by idx desc limit {start}, {page_length}""".format
(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition), (start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
{ {
'item_code': item_code, 'item_code': item_code,