mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 01:34:10 +00:00
fix(stock): set incoming_rate with lcv rate for internal purchase
(cherry picked from commit f0dccc3cd7)
This commit is contained in:
@@ -2328,6 +2328,7 @@ def get_incoming_rate_for_inter_company_transfer(sle) -> float:
|
||||
For inter company transfer, incoming rate is the average of the outgoing rate
|
||||
"""
|
||||
rate = 0.0
|
||||
lcv_rate = 0.0
|
||||
|
||||
field = "delivery_note_item" if sle.voucher_type == "Purchase Receipt" else "sales_invoice_item"
|
||||
|
||||
@@ -2342,7 +2343,15 @@ def get_incoming_rate_for_inter_company_transfer(sle) -> float:
|
||||
"incoming_rate",
|
||||
)
|
||||
|
||||
return rate
|
||||
# add lcv amount in incoming_rate
|
||||
lcv_amount = frappe.db.get_value(
|
||||
f"{sle.voucher_type} Item", sle.voucher_detail_no, "landed_cost_voucher_amount"
|
||||
)
|
||||
|
||||
if lcv_amount:
|
||||
lcv_rate = flt(lcv_amount / abs(sle.actual_qty))
|
||||
|
||||
return rate + lcv_rate
|
||||
|
||||
|
||||
def is_internal_transfer(sle):
|
||||
|
||||
Reference in New Issue
Block a user