Skip to content

Commit

Permalink
fix: don't check other warehouse ledgers to calculate valuation rate
Browse files Browse the repository at this point in the history
(cherry picked from commit ef2bf3c)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Jan 10, 2023
1 parent 68027b1 commit ab0a2b4
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit ab0a2b4

Please sign in to comment.