mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
chore: fix test case
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.tests.utils import FrappeTestCase, change_settings
|
from frappe.tests.utils import FrappeTestCase, change_settings
|
||||||
from frappe.utils import add_days, cint, cstr, flt, today, nowtime
|
from frappe.utils import add_days, cint, cstr, flt, nowtime, today
|
||||||
from pypika import functions as fn
|
from pypika import functions as fn
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
|
|||||||
@@ -1398,18 +1398,21 @@ def get_valuation_rate(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Get valuation rate from last sle for the same item and warehouse
|
# Get valuation rate from last sle for the same item and warehouse
|
||||||
if last_valuation_rate := frappe.db.sql(
|
if not last_valuation_rate or last_valuation_rate[0][0] is None:
|
||||||
"""select valuation_rate
|
last_valuation_rate = frappe.db.sql(
|
||||||
from `tabStock Ledger Entry` force index (item_warehouse)
|
"""select valuation_rate
|
||||||
where
|
from `tabStock Ledger Entry` force index (item_warehouse)
|
||||||
item_code = %s
|
where
|
||||||
AND warehouse = %s
|
item_code = %s
|
||||||
AND valuation_rate >= 0
|
AND warehouse = %s
|
||||||
AND is_cancelled = 0
|
AND valuation_rate >= 0
|
||||||
AND NOT (voucher_no = %s AND voucher_type = %s)
|
AND is_cancelled = 0
|
||||||
order by posting_datetime desc, name desc limit 1""",
|
AND NOT (voucher_no = %s AND voucher_type = %s)
|
||||||
(item_code, warehouse, voucher_no, voucher_type),
|
order by posting_datetime desc, name desc limit 1""",
|
||||||
):
|
(item_code, warehouse, voucher_no, voucher_type),
|
||||||
|
)
|
||||||
|
|
||||||
|
if last_valuation_rate:
|
||||||
return flt(last_valuation_rate[0][0])
|
return flt(last_valuation_rate[0][0])
|
||||||
|
|
||||||
# If negative stock allowed, and item delivered without any incoming entry,
|
# If negative stock allowed, and item delivered without any incoming entry,
|
||||||
|
|||||||
Reference in New Issue
Block a user