fix: internal Purchase Receipt GL Entries

(cherry picked from commit 6fca9adcd4)
This commit is contained in:
s-aga-r
2023-04-18 18:38:28 +05:30
committed by Mergify
parent a2d2beb610
commit b73422e4ee

View File

@@ -370,7 +370,19 @@ class PurchaseReceipt(BuyingController):
outgoing_amount = d.base_net_amount
if self.is_internal_supplier and d.valuation_rate:
outgoing_amount = d.valuation_rate * d.stock_qty
outgoing_amount = abs(
frappe.db.get_value(
"Stock Ledger Entry",
{
"voucher_type": "Purchase Receipt",
"voucher_no": self.name,
"voucher_detail_no": d.name,
"warehouse": d.from_warehouse,
"is_cancelled": 0,
},
"stock_value_difference",
)
)
credit_amount = outgoing_amount
if credit_amount: