Skip to content

Commit

Permalink
Merge pull request #2295 from frappe/mergify/bp/version-15-hotfix/pr-…
Browse files Browse the repository at this point in the history
…2276

fix(Expense Claim): update ledger entries after updating cost center (backport #2276)
  • Loading branch information
krantheman authored Oct 16, 2024
2 parents 9873915 + 083efe0 commit 5f3220a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions hrms/hr/doctype/expense_claim/expense_claim.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from frappe.utils import cstr, flt, get_link_to_form

import erpnext
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import (
validate_docs_for_voucher_types,
)
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.controllers.accounts_controller import AccountsController
Expand Down Expand Up @@ -107,6 +110,11 @@ def on_submit(self):

self.update_claimed_amount_in_employee_advance()

def on_update_after_submit(self):
if self.check_if_fields_updated([], {"taxes": ("account_head")}):
validate_docs_for_voucher_types(["Expense Claim"])
self.repost_accounting_entries()

def on_cancel(self):
self.update_task_and_project()
self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry", "Payment Ledger Entry")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"width": "150px"
},
{
"allow_on_submit": 1,
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
Expand All @@ -112,6 +113,7 @@
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
Expand All @@ -129,7 +131,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2024-01-08 11:47:28.315381",
"modified": "2024-10-10 14:58:36.316268",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim Detail",
Expand All @@ -138,4 +140,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"columns": 2,
"fieldname": "account_head",
"fieldtype": "Link",
Expand All @@ -37,6 +38,7 @@
"reqd": 1
},
{
"allow_on_submit": 1,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
Expand Down Expand Up @@ -95,6 +97,7 @@
"fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
Expand All @@ -107,7 +110,7 @@
],
"istable": 1,
"links": [],
"modified": "2023-08-07 13:39:17.889817",
"modified": "2024-10-10 14:57:01.414550",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Taxes and Charges",
Expand All @@ -118,4 +121,4 @@
"sort_order": "ASC",
"states": [],
"track_changes": 1
}
}

0 comments on commit 5f3220a

Please sign in to comment.