fix: don't check other warehouse ledgers to calculate valuation rate

(cherry picked from commit ef2bf3c223)
This commit is contained in:
Rohit Waghchaure
2023-01-10 10:59:50 +05:30
committed by Mergify
parent 410e617834
commit 66bf1071bb

View File

@@ -1184,20 +1184,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])