fix: provisional reverse entry amount
This commit is contained in:
parent
4173203382
commit
3e59c66806
@ -1025,7 +1025,7 @@ class PurchaseInvoice(BuyingController):
|
||||
purchase_receipt_doc_map[item.purchase_receipt] = purchase_receipt_doc
|
||||
|
||||
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
|
||||
expense_booked_in_pr = frappe.db.get_value(
|
||||
expense_booked_in_pr, credit = frappe.db.get_value(
|
||||
"GL Entry",
|
||||
{
|
||||
"is_cancelled": 0,
|
||||
@ -1034,13 +1034,13 @@ class PurchaseInvoice(BuyingController):
|
||||
"voucher_detail_no": item.pr_detail,
|
||||
"account": provisional_account,
|
||||
},
|
||||
["name"],
|
||||
["name", "credit"],
|
||||
)
|
||||
|
||||
if expense_booked_in_pr:
|
||||
# Intentionally passing purchase invoice item to handle partial billing
|
||||
purchase_receipt_doc.add_provisional_gl_entry(
|
||||
item, gl_entries, self.posting_date, provisional_account, reverse=1
|
||||
item, gl_entries, self.posting_date, provisional_account, reverse=1, item_amount=credit
|
||||
)
|
||||
|
||||
if not self.is_internal_transfer():
|
||||
|
@ -730,16 +730,19 @@ class PurchaseReceipt(BuyingController):
|
||||
)
|
||||
|
||||
def add_provisional_gl_entry(
|
||||
self, item, gl_entries, posting_date, provisional_account, reverse=0
|
||||
self, item, gl_entries, posting_date, provisional_account, reverse=0, item_amount=None
|
||||
):
|
||||
credit_currency = get_account_currency(provisional_account)
|
||||
expense_account = item.expense_account
|
||||
debit_currency = get_account_currency(item.expense_account)
|
||||
remarks = self.get("remarks") or _("Accounting Entry for Service")
|
||||
multiplication_factor = 1
|
||||
amount = item.base_amount
|
||||
|
||||
if reverse:
|
||||
multiplication_factor = -1
|
||||
# Post reverse entry for previously posted amount
|
||||
amount = item_amount
|
||||
expense_account = frappe.db.get_value(
|
||||
"Purchase Receipt Item", {"name": item.get("pr_detail")}, ["expense_account"]
|
||||
)
|
||||
@ -749,7 +752,7 @@ class PurchaseReceipt(BuyingController):
|
||||
account=provisional_account,
|
||||
cost_center=item.cost_center,
|
||||
debit=0.0,
|
||||
credit=multiplication_factor * item.base_amount,
|
||||
credit=multiplication_factor * amount,
|
||||
remarks=remarks,
|
||||
against_account=expense_account,
|
||||
account_currency=credit_currency,
|
||||
@ -763,7 +766,7 @@ class PurchaseReceipt(BuyingController):
|
||||
gl_entries=gl_entries,
|
||||
account=expense_account,
|
||||
cost_center=item.cost_center,
|
||||
debit=multiplication_factor * item.base_amount,
|
||||
debit=multiplication_factor * amount,
|
||||
credit=0.0,
|
||||
remarks=remarks,
|
||||
against_account=provisional_account,
|
||||
|
Loading…
x
Reference in New Issue
Block a user