Skip to content

Commit

Permalink
fix: use Stock Qty while getting POS Reserved Qty (backport #38962)…
Browse files Browse the repository at this point in the history
… (#38983)

fix: use `Stock Qty` while getting `POS Reserved Qty`

(cherry picked from commit 7223106)

Co-authored-by: s-aga-r <[email protected]>
  • Loading branch information
mergify[bot] and s-aga-r authored Dec 28, 2023
1 parent ab82e30 commit f5160dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions erpnext/accounts/doctype/pos_invoice/pos_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def get_pos_reserved_qty(item_code, warehouse):
reserved_qty = (
frappe.qb.from_(p_inv)
.from_(p_item)
.select(Sum(p_item.qty).as_("qty"))
.select(Sum(p_item.stock_qty).as_("stock_qty"))
.where(
(p_inv.name == p_item.parent)
& (IfNull(p_inv.consolidated_invoice, "") == "")
Expand All @@ -715,7 +715,7 @@ def get_pos_reserved_qty(item_code, warehouse):
)
).run(as_dict=True)

return reserved_qty[0].qty or 0 if reserved_qty else 0
return flt(reserved_qty[0].stock_qty) if reserved_qty else 0


@frappe.whitelist()
Expand Down

0 comments on commit f5160dc

Please sign in to comment.