From c37e744fedf145ddbdfa25df9b24ad6efbb2dcc5 Mon Sep 17 00:00:00 2001 From: Corentin Forler Date: Thu, 3 Oct 2024 18:38:23 +0200 Subject: [PATCH 1/2] fix(stock): Grab posting date/time from SABB --- 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 f73c435ffd3..4bbfac189a5 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1717,6 +1717,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"] + ) batch_obj = BatchNoValuation( sle=frappe._dict( { @@ -1724,6 +1727,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, } ) ) -- GitLab From 1abdcf4379db4e14f988ecffcbdb1d4a9b4c34c5 Mon Sep 17 00:00:00 2001 From: Corentin Forler <8860073-cforler_dokos@users.noreply.gitlab.com> Date: Fri, 4 Oct 2024 13:57:09 +0000 Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s) --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 4bbfac189a5..33927f60fe4 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1718,7 +1718,7 @@ 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"] + "Serial and Batch Bundle", serial_and_batch_bundle, ["posting_date", "posting_time"], as_dict=True ) batch_obj = BatchNoValuation( sle=frappe._dict( -- GitLab