From ef2bf3c22350351c8ddbc375c4d04a1f48854ed5 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 10 Jan 2023 10:59:50 +0530 Subject: [PATCH] fix: don't check other warehouse ledgers to calculate valuation rate --- erpnext/stock/stock_ledger.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 55a11a186716..5d75bfd05a3f 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1270,20 +1270,6 @@ def get_valuation_rate( (item_code, warehouse, voucher_no, voucher_type), ) - if not last_valuation_rate: - # Get valuation rate from last sle for the item against any warehouse - last_valuation_rate = frappe.db.sql( - """select valuation_rate - from `tabStock Ledger Entry` force index (item_code) - where - item_code = %s - AND valuation_rate > 0 - AND is_cancelled = 0 - AND NOT(voucher_no = %s AND voucher_type = %s) - order by posting_date desc, posting_time desc, name desc limit 1""", - (item_code, voucher_no, voucher_type), - ) - if last_valuation_rate: return flt(last_valuation_rate[0][0])