Skip to content

Payroll Entry fails with error #2838

@zahidmansoor

Description

@zahidmansoor

Information about bug

After updating erpnext to latest version the payroll entry cannot be submitted witht the following error.

Module

other

Version

ERPNext: v15.54.1 (version-15)

Frappe Framework: v15.57.2 (version-15)

Frappe HR: v15.41.0 (version-15)

Lending: v0.0.1 (develop)

Payments: v0.0.1 (develop)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

Traceback with variables (most recent call last):
  File "apps/hrms/hrms/payroll/doctype/payroll_entry/payroll_entry.py", line 1440, in create_salary_slips_for_employees
    frappe.get_doc(args).insert()
      employees = ['HR-EMP-00034', 'HR-EMP-00002', 'HR-EMP-00293', 'HR-EMP-00282']
      args = {'salary_slip_based_on_timesheet': 0, 'payroll_frequency': 'Monthly', 'start_date': '2025-02-01', 'end_date': '2025-02-28', 'company': 'Shamo Jee Internal', 'posting_date': '2025-02-28', 'deduct_tax_for_unclaimed_employee_benefits': 0, 'deduct_tax_for_unsubmitted_tax_exemption_proof': 0, 'payroll_entry': 'HR-PRUN-2025-00028', 'exchange_rate': 1, 'currency': 'PKR', 'doctype': 'Salary Slip', 'employee': 'HR-EMP-00034'}
      publish_progress = False
      payroll_entry = <PayrollEntry: HR-PRUN-2025-00028 docstatus=1>
      salary_slips_exist_for = []
      count = 0
      emp = 'HR-EMP-00034'
      e = ImportError("cannot import name 'process_loan_interest_accrual_for_term_loans' from 'lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual' (apps/lending/lending/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py)")
  File "apps/frappe/frappe/model/document.py", line 309, in insert
    self.run_before_save_methods()
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      ignore_permissions = None
      ignore_links = None
      ignore_if_duplicate = False
      ignore_mandatory = None
      set_name = None
      set_child_names = True
  File "apps/frappe/frappe/model/document.py", line 1136, in run_before_save_methods
    self.run_method("validate")
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
  File "apps/frappe/frappe/model/document.py", line 1007, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7f4516e23a30>
      method = 'validate'
  File "apps/frappe/frappe/model/document.py", line 1367, in composer
    return composed(self, method, *args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {}
      hooks = [<function apply at 0x7f45173572e0>, <function check_for_running_deletion_job at 0x7f45173acee0>]
      method = 'validate'
      doc_events = {'*': {'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date', 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'], 'after_rename': ['frappe.desk.notifications.clear_doctype_notifications'], 'on_cancel': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply'], 'on_trash': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions'], 'on_update_after_submit': ['frappe.workflow.doctype.workflow_action.workflow_action.process_w...
      handler = 'erpnext.setup.doctype.transaction_deletion_record.transaction_deletion_record.check_for_running_deletion_job'
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7f45172e4550>
      compose = <function Document.hook.<locals>.compose at 0x7f4516e235b0>
      f = <function Document.run_method.<locals>.fn at 0x7f4516e23a30>
  File "apps/frappe/frappe/model/document.py", line 1349, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      method = 'validate'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7f4516e23250>
      fn = <function Document.run_method.<locals>.fn at 0x7f4516e23a30>
      hooks = (<function apply at 0x7f45173572e0>, <function check_for_running_deletion_job at 0x7f45173acee0>)
  File "apps/frappe/frappe/model/document.py", line 1004, in fn
    return method_object(*args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {}
      method_object = <bound method SalarySlip.validate of <SalarySlip: Sal Slip/HR-EMP-00034/00040>>
      method = 'validate'
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 149, in validate
    self.get_emp_and_working_day_details()
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
      args = (<SalarySlip: Sal Slip/HR-EMP-00034/00040>,)
      kwargs = {}
      apply_condition = <function whitelist.<locals>.innerfn.<locals>.<lambda> at 0x7f45173a5900>
      func = <function SalarySlip.get_emp_and_working_day_details at 0x7f45173a5870>
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 347, in get_emp_and_working_day_details
    self.pull_sal_struct()
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      struct = '2024-2025'
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 421, in pull_sal_struct
    make_salary_slip(self._salary_structure_doc.name, self)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      make_salary_slip = <function make_salary_slip at 0x7f451736f760>
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
      args = ('2024-2025', <SalarySlip: Sal Slip/HR-EMP-00034/00040>)
      kwargs = {}
      apply_condition = <function whitelist.<locals>.innerfn.<locals>.<lambda> at 0x7f451736f6d0>
      func = <function make_salary_slip at 0x7f451736f640>
  File "apps/hrms/hrms/payroll/doctype/salary_structure/salary_structure.py", line 377, in make_salary_slip
    doc = get_mapped_doc(
      source_name = '2024-2025'
      target_doc = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      as_print = False
      print_format = None
      ignore_permissions = False
      postprocess = <function make_salary_slip.<locals>.postprocess at 0x7f45172e49d0>
      employee = None
      for_preview = 0
      posting_date = None
  File "apps/frappe/frappe/model/mapper.py", line 155, in get_mapped_doc
    postprocess(source_doc, target_doc)
      from_doctype = 'Salary Structure'
      from_docname = '2024-2025'
      table_maps = {'Salary Structure': {'doctype': 'Salary Slip', 'field_map': {'total_earning': 'gross_pay', 'name': 'salary_structure', 'currency': 'currency'}}}
      target_doc = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      postprocess = <function make_salary_slip.<locals>.postprocess at 0x7f45172e49d0>
      ignore_permissions = False
      ignore_child_tables = True
      cached = True
      apply_strict_user_permissions = 1
      source_doc = <SalaryStructure: 2024-2025 docstatus=1>
      row_exists_for_parentfield = {}
  File "apps/hrms/hrms/payroll/doctype/salary_structure/salary_structure.py", line 375, in postprocess
    target.run_method("process_salary_structure", for_preview=for_preview)
      source = <SalaryStructure: 2024-2025 docstatus=1>
      target = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      employee = None
      for_preview = 0
      posting_date = None
  File "apps/frappe/frappe/model/document.py", line 1007, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {'for_preview': 0}
      fn = <function Document.run_method.<locals>.fn at 0x7f45172e4670>
      method = 'process_salary_structure'
  File "apps/frappe/frappe/model/document.py", line 1367, in composer
    return composed(self, method, *args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {'for_preview': 0}
      hooks = []
      method = 'process_salary_structure'
      doc_events = {'*': {'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date', 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'], 'after_rename': ['frappe.desk.notifications.clear_doctype_notifications'], 'on_cancel': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply'], 'on_trash': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions'], 'on_update_after_submit': ['frappe.workflow.doctype.workflow_action.workflow_action.process_w...
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7f4516cc1750>
      compose = <function Document.hook.<locals>.compose at 0x7f4516cc15a0>
      f = <function Document.run_method.<locals>.fn at 0x7f45172e4670>
  File "apps/frappe/frappe/model/document.py", line 1349, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      method = 'process_salary_structure'
      args = ()
      kwargs = {'for_preview': 0}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7f45172e4af0>
      fn = <function Document.run_method.<locals>.fn at 0x7f45172e4670>
      hooks = ()
  File "apps/frappe/frappe/model/document.py", line 1004, in fn
    return method_object(*args, **kwargs)
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      args = ()
      kwargs = {'for_preview': 0}
      method_object = <bound method SalarySlip.process_salary_structure of <SalarySlip: Sal Slip/HR-EMP-00034/00040>>
      method = 'process_salary_structure'
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 1931, in process_salary_structure
    self.calculate_net_pay()
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      for_preview = 0
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 805, in calculate_net_pay
    set_loan_repayment(self)
      skip_tax_breakup_computation = False
      set_gross_pay_and_base_gross_pay = <function SalarySlip.calculate_net_pay.<locals>.set_gross_pay_and_base_gross_pay at 0x7f4516cc1480>
      self = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip_loan_utils.py", line 18, in wrapper
    return function(*args, **kwargs)
      args = (<SalarySlip: Sal Slip/HR-EMP-00034/00040>,)
      kwargs = {}
      function = <function set_loan_repayment at 0x7f451712c280>
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip_loan_utils.py", line 35, in set_loan_repayment
    process_loan_interest_accruals(loan_details, doc.end_date)
      doc = <SalarySlip: Sal Slip/HR-EMP-00034/00040>
      calculate_amounts = <function calculate_amounts at 0x7f4516e744c0>
      loan_details = [{'name': 'ACC-LOAN-2025-00036', 'interest_income_account': 'Employee Loans Income - SJ', 'loan_account': 'Employee Loans - SJ', 'loan_product': 'Employee Loans', 'is_term_loan': 1}]
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip_loan_utils.py", line 91, in process_loan_interest_accruals
    from lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
      loan_details = [{'name': 'ACC-LOAN-2025-00036', 'interest_income_account': 'Employee Loans Income - SJ', 'loan_account': 'Employee Loans - SJ', 'loan_product': 'Employee Loans', 'is_term_loan': 1}]
      posting_date = '2025-02-28'
builtins.ImportError: cannot import name 'process_loan_interest_accrual_for_term_loans' from 'lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual' (apps/lending/lending/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions