fix: internal transfer condition
(cherry picked from commitb5a2ccf21d) (cherry picked from commita1d717053a)
This commit is contained in:
committed by
Mergify
parent
1380f7a7ec
commit
ac26e4ba2a
@@ -369,7 +369,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
)
|
)
|
||||||
|
|
||||||
outgoing_amount = d.base_net_amount
|
outgoing_amount = d.base_net_amount
|
||||||
if self.is_internal_supplier and d.valuation_rate:
|
if self.is_internal_transfer() and d.valuation_rate:
|
||||||
outgoing_amount = abs(
|
outgoing_amount = abs(
|
||||||
frappe.db.get_value(
|
frappe.db.get_value(
|
||||||
"Stock Ledger Entry",
|
"Stock Ledger Entry",
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ class update_entries_after(object):
|
|||||||
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
|
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
|
||||||
and sle.voucher_detail_no
|
and sle.voucher_detail_no
|
||||||
and sle.actual_qty < 0
|
and sle.actual_qty < 0
|
||||||
and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier")
|
and is_internal_transfer(sle)
|
||||||
):
|
):
|
||||||
sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle)
|
sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle)
|
||||||
|
|
||||||
@@ -648,7 +648,7 @@ class update_entries_after(object):
|
|||||||
elif (
|
elif (
|
||||||
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
|
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
|
||||||
and sle.voucher_detail_no
|
and sle.voucher_detail_no
|
||||||
and frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_internal_supplier")
|
and is_internal_transfer(sle)
|
||||||
):
|
):
|
||||||
rate = get_incoming_rate_for_inter_company_transfer(sle)
|
rate = get_incoming_rate_for_inter_company_transfer(sle)
|
||||||
else:
|
else:
|
||||||
@@ -1488,3 +1488,15 @@ def get_incoming_rate_for_inter_company_transfer(sle) -> float:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return rate
|
return rate
|
||||||
|
|
||||||
|
|
||||||
|
def is_internal_transfer(sle):
|
||||||
|
data = frappe.get_cached_value(
|
||||||
|
sle.voucher_type,
|
||||||
|
sle.voucher_no,
|
||||||
|
["is_internal_supplier", "represents_company", "company"],
|
||||||
|
as_dict=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
if data.is_internal_supplier and data.represents_company == data.company:
|
||||||
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user