Skip to content

Commit

Permalink
fix(Expense Claim): update ledger after updating cost center
Browse files Browse the repository at this point in the history
  • Loading branch information
krantheman committed Oct 10, 2024
1 parent 6de43f3 commit 3d6d716
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 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-03-27 13:09:44.085960",
"modified": "2024-10-10 14:58:36.316268",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim Detail",
Expand Down
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": "2024-03-27 13:09:44.377350",
"modified": "2024-10-10 14:57:01.414550",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Taxes and Charges",
Expand Down

0 comments on commit 3d6d716

Please sign in to comment.