From cd9f949b1288708876dd908403616ce0c2e7b6b8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:45:35 +0530 Subject: [PATCH] fix(stock): Grab posting date/time from SABB (backport #43493) (#43502) fix(stock): Grab posting date/time from SABB (#43493) (cherry picked from commit ade121dac614612405f976014707045ed97181a9) Co-authored-by: Corentin Forler <10946971+cogk@users.noreply.github.com> --- erpnext/stock/stock_ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index dfa60cad96e..0f058d0a64b 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1740,6 +1740,9 @@ def get_valuation_rate( # Get moving average rate of a specific batch number if warehouse and serial_and_batch_bundle: + sabb = frappe.db.get_value( + "Serial and Batch Bundle", serial_and_batch_bundle, ["posting_date", "posting_time"], as_dict=True + ) batch_obj = BatchNoValuation( sle=frappe._dict( { @@ -1747,6 +1750,8 @@ def get_valuation_rate( "warehouse": warehouse, "actual_qty": -1, "serial_and_batch_bundle": serial_and_batch_bundle, + "posting_date": sabb.posting_date, + "posting_time": sabb.posting_time, } ) )