fix: consider outgoingrate while valuation rate calculate
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 7ced1da..cdf6e89 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -542,6 +542,14 @@
 		if not self.args.get("sle_id"):
 			self.get_dynamic_incoming_outgoing_rate(sle)
 
+		if (
+			sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
+			and sle.voucher_detail_no
+			and sle.actual_qty < 0
+			and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier")
+		):
+			sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle)
+
 		if get_serial_nos(sle.serial_no):
 			self.get_serialized_values(sle)
 			self.wh_data.qty_after_transaction += flt(sle.actual_qty)
@@ -590,14 +598,6 @@
 		sle.stock_value_difference = stock_value_difference
 		sle.doctype = "Stock Ledger Entry"
 
-		if (
-			sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
-			and sle.voucher_detail_no
-			and sle.actual_qty < 0
-			and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier")
-		):
-			sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle)
-
 		frappe.get_doc(sle).db_update()
 
 		if not self.args.get("sle_id"):