fix: LCV updates wrong future qty/Bin qty

- As -ve LCV SLE case is returned from `repost_current_voucher`, future qty is not updated
- This just doubly shifts all future qty which is then fixed by a repost
- Until the repost balance values are wrong
- Bin continues to show wrong projected qty even after repost, this is fixed by next SLE that recalculates Bin

(cherry picked from commit 7a5fd71a6c)
This commit is contained in:
marination
2022-07-04 17:46:54 +05:30
committed by Mergify
parent 31930a16fa
commit f0ecdbef5a

View File

@@ -94,27 +94,26 @@ def repost_current_voucher(args, allow_negative_stock=False, via_landed_cost_vou
if not args.get("posting_date"): if not args.get("posting_date"):
args["posting_date"] = nowdate() args["posting_date"] = nowdate()
if args.get("is_cancelled") and via_landed_cost_voucher: if not (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
# Reposts only current voucher SL Entries update_entries_after(
# Updates valuation rate, stock value, stock queue for current transaction {
update_entries_after( "item_code": args.get("item_code"),
{ "warehouse": args.get("warehouse"),
"item_code": args.get("item_code"), "posting_date": args.get("posting_date"),
"warehouse": args.get("warehouse"), "posting_time": args.get("posting_time"),
"posting_date": args.get("posting_date"), "voucher_type": args.get("voucher_type"),
"posting_time": args.get("posting_time"), "voucher_no": args.get("voucher_no"),
"voucher_type": args.get("voucher_type"), "sle_id": args.get("name"),
"voucher_no": args.get("voucher_no"), "creation": args.get("creation"),
"sle_id": args.get("name"), },
"creation": args.get("creation"), allow_negative_stock=allow_negative_stock,
}, via_landed_cost_voucher=via_landed_cost_voucher,
allow_negative_stock=allow_negative_stock, )
via_landed_cost_voucher=via_landed_cost_voucher,
)
# update qty in future sle and Validate negative qty # 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) update_qty_in_future_sle(args, allow_negative_stock)