Skip to content

Commit

Permalink
fix: consider outgoingrate while valuation rate calculate
Browse files Browse the repository at this point in the history
(cherry picked from commit 3266e54)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Oct 12, 2022
1 parent 948b231 commit 423c019
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions erpnext/stock/stock_ledger.py
Expand Up @@ -542,6 +542,14 @@ def process_sle(self, sle):
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)
Expand Down Expand Up @@ -590,14 +598,6 @@ def process_sle(self, sle):
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"):
Expand Down

0 comments on commit 423c019

Please sign in to comment.