From 1df54114a87b665148ccfdcf294eae2ec501f605 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 20 Mar 2024 20:20:44 +0530 Subject: [PATCH] chore: fixed test case --- erpnext/stock/stock_ledger.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index a642a1ff7ed..96a554de72b 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1340,9 +1340,15 @@ def get_batch_incoming_rate( item_code, warehouse, batch_no, posting_date, posting_time, creation=None ): + import datetime + sle = frappe.qb.DocType("Stock Ledger Entry") - timestamp_condition = sle.posting_datetime < get_combine_datetime(posting_date, posting_time) + posting_datetime = get_combine_datetime(posting_date, posting_time) + if not creation: + posting_datetime = posting_datetime + datetime.timedelta(milliseconds=1) + + timestamp_condition = sle.posting_datetime < posting_datetime if creation: timestamp_condition |= ( sle.posting_datetime == get_combine_datetime(posting_date, posting_time)