mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-04 00:50:18 +00:00
fix: Tax amount not considered in Expense Claim Journal Entry
- add a helper function `get_outstanding_amount_for_claim` for uniformity in usages
This commit is contained in:
@@ -339,6 +339,30 @@ def update_reimbursed_amount(doc, amount):
|
||||
frappe.db.set_value("Expense Claim", doc.name, "status", doc.status)
|
||||
|
||||
|
||||
def get_outstanding_amount_for_claim(claim):
|
||||
if isinstance(claim, str):
|
||||
claim = frappe.db.get_value(
|
||||
"Expense Claim",
|
||||
claim,
|
||||
(
|
||||
"total_sanctioned_amount",
|
||||
"total_taxes_and_charges",
|
||||
"total_amount_reimbursed",
|
||||
"total_advance_amount",
|
||||
),
|
||||
as_dict=True,
|
||||
)
|
||||
|
||||
outstanding_amt = (
|
||||
flt(claim.total_sanctioned_amount)
|
||||
+ flt(claim.total_taxes_and_charges)
|
||||
- flt(claim.total_amount_reimbursed)
|
||||
- flt(claim.total_advance_amount)
|
||||
)
|
||||
|
||||
return outstanding_amt
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_bank_entry(dt, dn):
|
||||
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
|
||||
@@ -348,11 +372,7 @@ def make_bank_entry(dt, dn):
|
||||
if not default_bank_cash_account:
|
||||
default_bank_cash_account = get_default_bank_cash_account(expense_claim.company, "Cash")
|
||||
|
||||
payable_amount = (
|
||||
flt(expense_claim.total_sanctioned_amount)
|
||||
- flt(expense_claim.total_amount_reimbursed)
|
||||
- flt(expense_claim.total_advance_amount)
|
||||
)
|
||||
payable_amount = get_outstanding_amount_for_claim(expense_claim)
|
||||
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.voucher_type = "Bank Entry"
|
||||
|
||||
Reference in New Issue
Block a user