From ad6e3a45d224b420a7b3ff4ed20c72cb40783e7f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 22:40:11 +0530 Subject: [PATCH] fix(stock): get_actual_qty during cancellations (backport #55388) (#55391) Co-authored-by: archielister fix(stock): get_actual_qty during cancellations (#55388) --- erpnext/stock/doctype/bin/bin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 79e9776b91c..2af1f645494 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -263,8 +263,9 @@ def update_qty(bin_name, args): # actual qty is already updated by processing current voucher actual_qty = bin_details.actual_qty or 0.0 - # actual qty is not up to date in case of backdated transaction - if future_sle_exists(args): + # actual qty is not up to date in case of backdated transactions + # or when cancellations are the most recent SLE + if future_sle_exists(args) or args.get("is_cancelled"): actual_qty = get_actual_qty(args.get("item_code"), args.get("warehouse")) ordered_qty = flt(bin_details.ordered_qty) + flt(args.get("ordered_qty"))