From 9e649d852237a54bae334f7c6f413cbdd38f54c5 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 2 Mar 2025 11:29:39 +0530 Subject: [PATCH] fix: dont update rate of free item when batch is updated (cherry picked from commit a3596f717b6a8145535d4a133d518f565e4ec0c5) # Conflicts: # erpnext/stock/get_item_details.py --- erpnext/stock/get_item_details.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 5c5fe5db276..58f83d7a593 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -221,7 +221,7 @@ def update_stock(ctx, out, doc=None): else: qty -= batch_qty - out.update({"batch_no": batch_no, "actual_batch_qty": qty}) + out.update({"batch_no": batch_no, "actual_batch_qty": batch_qty}) if rate: out.update({"rate": rate, "price_list_rate": rate}) @@ -1051,8 +1051,13 @@ def get_batch_based_item_price(params, item_code) -> float: if not item_price: item_price = get_item_price(params, item_code, ignore_party=True, force_batch_no=True) +<<<<<<< HEAD if item_price and item_price[0][2] == params.get("uom"): return item_price[0][1] +======= + if item_price and item_price[0].uom == pctx.uom and not pctx.get("items")[0].get("is_free_item"): + return item_price[0].price_list_rate +>>>>>>> a3596f717b (fix: dont update rate of free item when batch is updated) return 0.0