diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index ba2d3c1512..3659bd03b2 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -95,27 +95,26 @@ def repost_current_voucher(args, allow_negative_stock=False, via_landed_cost_vou if not args.get("posting_date"): args["posting_date"] = nowdate() - if args.get("is_cancelled") and via_landed_cost_voucher: - return - - # Reposts only current voucher SL Entries - # Updates valuation rate, stock value, stock queue for current transaction - update_entries_after( - { - "item_code": args.get("item_code"), - "warehouse": args.get("warehouse"), - "posting_date": args.get("posting_date"), - "posting_time": args.get("posting_time"), - "voucher_type": args.get("voucher_type"), - "voucher_no": args.get("voucher_no"), - "sle_id": args.get("name"), - "creation": args.get("creation"), - }, - allow_negative_stock=allow_negative_stock, - via_landed_cost_voucher=via_landed_cost_voucher, - ) + if not (args.get("is_cancelled") and via_landed_cost_voucher): + # Reposts only current voucher SL Entries + # Updates valuation rate, stock value, stock queue for current transaction + update_entries_after( + { + "item_code": args.get("item_code"), + "warehouse": args.get("warehouse"), + "posting_date": args.get("posting_date"), + "posting_time": args.get("posting_time"), + "voucher_type": args.get("voucher_type"), + "voucher_no": args.get("voucher_no"), + "sle_id": args.get("name"), + "creation": args.get("creation"), + }, + allow_negative_stock=allow_negative_stock, + via_landed_cost_voucher=via_landed_cost_voucher, + ) # update qty in future sle and Validate negative qty + # For LCV: update future balances with -ve LCV SLE, which will be balanced by +ve LCV SLE update_qty_in_future_sle(args, allow_negative_stock)