mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +00:00
fix: negative stock qty error for stock reconciliation (#41283)
fix: negative stock qty error for stock reco
This commit is contained in:
@@ -1490,6 +1490,10 @@ def get_stock_reco_qty_shift(args):
|
|||||||
stock_reco_qty_shift = flt(args.qty_after_transaction) - flt(last_balance)
|
stock_reco_qty_shift = flt(args.qty_after_transaction) - flt(last_balance)
|
||||||
else:
|
else:
|
||||||
stock_reco_qty_shift = flt(args.actual_qty)
|
stock_reco_qty_shift = flt(args.actual_qty)
|
||||||
|
|
||||||
|
elif args.get("serial_no") or args.get("batch_no"):
|
||||||
|
stock_reco_qty_shift = flt(args.actual_qty)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# reco is being submitted
|
# reco is being submitted
|
||||||
last_balance = get_previous_sle_of_current_voucher(args, "<=", exclude_current_voucher=True).get(
|
last_balance = get_previous_sle_of_current_voucher(args, "<=", exclude_current_voucher=True).get(
|
||||||
@@ -1559,6 +1563,15 @@ def get_datetime_limit_condition(detail):
|
|||||||
def validate_negative_qty_in_future_sle(args, allow_negative_stock=False):
|
def validate_negative_qty_in_future_sle(args, allow_negative_stock=False):
|
||||||
if allow_negative_stock or is_negative_stock_allowed(item_code=args.item_code):
|
if allow_negative_stock or is_negative_stock_allowed(item_code=args.item_code):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (
|
||||||
|
args.voucher_type == "Stock Reconciliation"
|
||||||
|
and args.actual_qty < 0
|
||||||
|
and args.get("batch_no")
|
||||||
|
and frappe.db.get_value("Stock Reconciliation Item", args.voucher_detail_no, "qty") > 0
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
if not (args.actual_qty < 0 or args.voucher_type == "Stock Reconciliation"):
|
if not (args.actual_qty < 0 or args.voucher_type == "Stock Reconciliation"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user