Merge branch 'develop' into stock-reservation

This commit is contained in:
Sagar Sharma
2023-05-08 16:47:40 +05:30
committed by GitHub
46 changed files with 32497 additions and 32179 deletions

View File

@@ -560,7 +560,7 @@ class update_entries_after(object):
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")
and is_internal_transfer(sle)
):
sle.outgoing_rate = get_incoming_rate_for_inter_company_transfer(sle)
@@ -683,7 +683,7 @@ class update_entries_after(object):
elif (
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
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)
else:
@@ -1619,3 +1619,15 @@ def get_incoming_rate_for_inter_company_transfer(sle) -> float:
)
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