Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Expense Claim): update ledger entries after updating cost center (backport #2276) #2295

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading