Merge pull request #33918 from rohitwaghchaure/fixed-incorrect-bin-qty
fix: incorrect actual qty in Bin
This commit is contained in:
commit
fbf2d7e9de
@ -159,13 +159,18 @@ def update_qty(bin_name, args):
|
||||
last_sle_qty = (
|
||||
frappe.qb.from_(sle)
|
||||
.select(sle.qty_after_transaction)
|
||||
.where((sle.item_code == args.get("item_code")) & (sle.warehouse == args.get("warehouse")))
|
||||
.where(
|
||||
(sle.item_code == args.get("item_code"))
|
||||
& (sle.warehouse == args.get("warehouse"))
|
||||
& (sle.is_cancelled == 0)
|
||||
)
|
||||
.orderby(CombineDatetime(sle.posting_date, sle.posting_time), order=Order.desc)
|
||||
.orderby(sle.creation, order=Order.desc)
|
||||
.limit(1)
|
||||
.run()
|
||||
)
|
||||
|
||||
actual_qty = 0.0
|
||||
if last_sle_qty:
|
||||
actual_qty = last_sle_qty[0][0]
|
||||
|
||||
|
@ -1179,7 +1179,7 @@ def get_stock_ledger_entries(
|
||||
def get_sle_by_voucher_detail_no(voucher_detail_no, excluded_sle=None):
|
||||
return frappe.db.get_value(
|
||||
"Stock Ledger Entry",
|
||||
{"voucher_detail_no": voucher_detail_no, "name": ["!=", excluded_sle]},
|
||||
{"voucher_detail_no": voucher_detail_no, "name": ["!=", excluded_sle], "is_cancelled": 0},
|
||||
[
|
||||
"item_code",
|
||||
"warehouse",
|
||||
|
Loading…
Reference in New Issue
Block a user