Skip to content

Commit

Permalink
fix: duplicate items and outdated item price in POS (backport #42978) (
Browse files Browse the repository at this point in the history
…#44038)

fix: duplicate items and outdated item price in POS (#42978)

* fix: duplicate items and outdated item price in POS

* fix: duplicate items and outdated item price in POS --formatter

(cherry picked from commit 4ea2071)

Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Nihantra-Patel authored Nov 8, 2024
1 parent 56f25ae commit 4cde77d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion erpnext/selling/page/point_of_sale/point_of_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def get_items(start, page_length, price_list, item_group, pos_profile, search_te
if not items_data:
return result

current_date = frappe.utils.today()

for item in items_data:
uoms = frappe.get_doc("Item", item.item_code).get("uoms", [])

Expand All @@ -167,12 +169,16 @@ def get_items(start, page_length, price_list, item_group, pos_profile, search_te

item_price = frappe.get_all(
"Item Price",
fields=["price_list_rate", "currency", "uom", "batch_no"],
fields=["price_list_rate", "currency", "uom", "batch_no", "valid_from", "valid_upto"],
filters={
"price_list": price_list,
"item_code": item.item_code,
"selling": True,
"valid_from": ["<=", current_date],
"valid_upto": ["in", [None, "", current_date]],
},
order_by="valid_from desc",
limit=1,
)

if not item_price:
Expand Down

0 comments on commit 4cde77d

Please sign in to comment.