mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
Merge pull request #45235 from frappe/mergify/bp/version-15/pr-45218
fix: incorrect valuation rate for PI based revaluation (backport #45207) (backport #45218)
This commit is contained in:
@@ -1039,7 +1039,7 @@ class update_entries_after:
|
|||||||
|
|
||||||
def get_dynamic_incoming_outgoing_rate(self, sle):
|
def get_dynamic_incoming_outgoing_rate(self, sle):
|
||||||
# Get updated incoming/outgoing rate from transaction
|
# Get updated incoming/outgoing rate from transaction
|
||||||
if sle.recalculate_rate:
|
if sle.recalculate_rate or self.has_landed_cost_based_on_pi(sle):
|
||||||
rate = self.get_incoming_outgoing_rate_from_transaction(sle)
|
rate = self.get_incoming_outgoing_rate_from_transaction(sle)
|
||||||
|
|
||||||
if flt(sle.actual_qty) >= 0:
|
if flt(sle.actual_qty) >= 0:
|
||||||
@@ -1047,6 +1047,14 @@ class update_entries_after:
|
|||||||
else:
|
else:
|
||||||
sle.outgoing_rate = rate
|
sle.outgoing_rate = rate
|
||||||
|
|
||||||
|
def has_landed_cost_based_on_pi(self, sle):
|
||||||
|
if sle.voucher_type == "Purchase Receipt" and frappe.db.get_single_value(
|
||||||
|
"Buying Settings", "set_landed_cost_based_on_purchase_invoice_rate"
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def get_incoming_outgoing_rate_from_transaction(self, sle):
|
def get_incoming_outgoing_rate_from_transaction(self, sle):
|
||||||
rate = 0
|
rate = 0
|
||||||
# Material Transfer, Repack, Manufacturing
|
# Material Transfer, Repack, Manufacturing
|
||||||
|
|||||||
Reference in New Issue
Block a user