erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

Salary Slips having Salary Structures with one of the component calculated based on Timesheet cannot be submitted until atleast one timesheet is Created

Open maveezmh opened this issue 2 years ago • 0 comments

Information about bug

Salary Slips having Salary Structures with one of the component calculated based on Timesheet cannot be submitted until atleast one timesheet is Created

image

When you try to create salary slips from payroll and submit it the system automatically adds timesheet component with zero values and throw following error on submittion.

image

Row 3: Both Debit and Credit values cannot be zero Check Error Log [35] for more details.

Module

accounts, HR

Version

ERPNext: v14.1.2 (HEAD)

Frappe Framework: v14.7.0 (HEAD)

Frappe HR: v0.0.1 (HEAD)

Payments: v0.0.1 (HEAD)

Installation method

FrappeCloud

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 949, in submit_salary_slips_for_employees
    payroll_entry.make_accrual_jv_entry()
      payroll_entry = <PayrollEntry: HR-PRUN-2022-00002 docstatus=1>
      salary_slips = (('Sal Slip/HR-EMP-00001/00002', 'Maveez'),)
      publish_progress = False
      submitted = [<SalarySlip: Sal Slip/HR-EMP-00001/00002 docstatus=1>]
      unsubmitted = []
      count = 1
      entry = ('Sal Slip/HR-EMP-00001/00002', 'Maveez')
      salary_slip = <SalarySlip: Sal Slip/HR-EMP-00001/00002 docstatus=1>
      e = ValidationError('Row 3: Both Debit and Credit values cannot be zero')
  File "apps/hrms/hrms/payroll/doctype/payroll_entry/payroll_entry.py", line 451, in make_accrual_jv_entry
    journal_entry.save()
      self = <PayrollEntry: HR-PRUN-2022-00002 docstatus=1>
      earnings = {('HRA Expenses - EI', 'Main - EI'): 1000.0, ('Travel Allowances - EI', 'Main - EI'): 500.0, ('Overtime Expenses - EI', 'Main - EI'): 0.0, ('Gratuity Expenses - EI', 'Main - EI'): 416.67, ('Basic Salary - EI', 'Main - EI'): 5000.0}
      deductions = {('Employee Gratuity - EI', 'Main - EI'): 416.67}
      payroll_payable_account = 'Staff Payable - EI'
      jv_name = ''
      precision = 2
      journal_entry = <JournalEntry: ACC-JV-2022-00005>
      accounting_dimensions = []
      accounts = [{'account': 'HRA Expenses - EI', 'debit_in_account_currency': 1000.0, 'exchange_rate': 1.0, 'cost_center': 'Main - EI', 'project': None, 'doctype': 'Journal Entry Account'}, {'account': 'Travel Allowances - EI', 'debit_in_account_currency': 500.0, 'exchange_rate': 1.0, 'cost_center': 'Main - EI', 'project': None, 'doctype': 'Journal Entry Account'}, {'account': 'Overtime Expenses - EI', 'debit_in_account_currency': 0.0, 'exchange_rate': 1.0, 'cost_center': 'Main - EI', 'project': None, 'doctype': 'Journal Entry Account'}, {'account': 'Gratuity Expenses - EI', 'debit_in_account_currency': 416.67, 'exchange_rate': 1.0, 'cost_center': 'Main - EI', 'project': None, 'doctype': 'Journal Entry Account'}, {'account': 'Basic Salary - EI', 'debit_in_account_currency': 5000.0, 'exchange_rate': 1.0, 'cost_center': 'Main - EI', 'project': None, 'doctype': 'Journal Entry Account'}, {'account': 'Employee Gratuity - EI', 'credit_in_account_currency': 416.67, 'exchange_rate': 1.0, 'cost_center': 'Main...
      currencies = ['AED']
      payable_amount = 6500.0
      multi_currency = 0
      company_currency = 'AED'
      acc_cc = ('Employee Gratuity - EI', 'Main - EI')
      amount = 416.67
      exchange_rate = 1
      amt = 416.67
      payable_amt = 6500.0
  File "apps/frappe/frappe/model/document.py", line 301, in save
    return self._save(*args, **kwargs)
      self = <JournalEntry: ACC-JV-2022-00005>
      args = ()
      kwargs = {}
  File "apps/frappe/frappe/model/document.py", line 323, in _save
    return self.insert()
      self = <JournalEntry: ACC-JV-2022-00005>
      ignore_permissions = None
      ignore_version = None
  File "apps/frappe/frappe/model/document.py", line 255, in insert
    self.run_before_save_methods()
      self = <JournalEntry: ACC-JV-2022-00005>
      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 1056, in run_before_save_methods
    self.run_method("validate")
      self = <JournalEntry: ACC-JV-2022-00005>
  File "apps/frappe/frappe/model/document.py", line 928, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <JournalEntry: ACC-JV-2022-00005>
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7f77a2f5dc60>
      method = 'validate'
  File "apps/frappe/frappe/model/document.py", line 1268, in composer
    return composed(self, method, *args, **kwargs)
      self = <JournalEntry: ACC-JV-2022-00005>
      args = ()
      kwargs = {}
      hooks = [<function validate_expense_claim_in_jv at 0x7f77a3c227a0>, <function apply at 0x7f77a3a5a0e0>]
      method = 'validate'
      doc_events = {'*': {'after_insert': ['frappe.event_streaming.doctype.event_update_log.event_update_log.notify_consumers'], 'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.core.doctype.activity_log.feed.update_feed', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.event_streaming.doctype.event_update_log.event_update_log.notify_consumers', '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.event_streaming.doctype.event_update_log.event_update_log.notify_co...
      handler = 'erpnext.support.doctype.service_level_agreement.service_level_agreement.apply'
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7f77a3339630>
      compose = <function Document.hook.<locals>.compose at 0x7f77a33391b0>
      f = <function Document.run_method.<locals>.fn at 0x7f77a2f5dc60>
  File "apps/frappe/frappe/model/document.py", line 1250, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <JournalEntry: ACC-JV-2022-00005>
      method = 'validate'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7f77a2f5de10>
      fn = <function Document.run_method.<locals>.fn at 0x7f77a2f5dc60>
      hooks = (<function validate_expense_claim_in_jv at 0x7f77a3c227a0>, <function apply at 0x7f77a3a5a0e0>)
  File "apps/frappe/frappe/model/document.py", line 925, in fn
    return method_object(*args, **kwargs)
      self = <JournalEntry: ACC-JV-2022-00005>
      args = ()
      kwargs = {}
      method_object = <bound method JournalEntry.validate of <JournalEntry: ACC-JV-2022-00005>>
      method = 'validate'
  File "apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py", line 53, in validate
    self.validate_debit_credit_amount()
      self = <JournalEntry: ACC-JV-2022-00005>
  File "apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py", line 607, in validate_debit_credit_amount
    frappe.throw(_("Row {0}: Both Debit and Credit values cannot be zero").format(d.idx))
      self = <JournalEntry: ACC-JV-2022-00005>
      d = <JournalEntryAccount: 9e1801dc4d parent=ACC-JV-2022-00005>
  File "apps/frappe/frappe/__init__.py", line 524, in throw
    msgprint(
      msg = 'Row 3: Both Debit and Credit values cannot be zero'
      exc = <class 'frappe.exceptions.ValidationError'>
      title = None
      is_minimizable = False
      wide = False
      as_list = False
  File "apps/frappe/frappe/__init__.py", line 492, in msgprint
    _raise_exception()
      title = None
      as_table = False
      as_list = False
      indicator = 'red'
      alert = False
      primary_action = None
      is_minimizable = False
      wide = False
      sys = <module 'sys' (built-in)>
      out = {'message': 'Row 3: Both Debit and Credit values cannot be zero', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1}
      _strip_html_tags = <functools._lru_cache_wrapper object at 0x7f77a2c6c670>
      _raise_exception = <function msgprint.<locals>._raise_exception at 0x7f77a33396c0>
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Row 3: Both Debit and Credit values cannot be zero'
      raise_exception = <class 'frappe.exceptions.ValidationError'>
      strip_html_tags = <function strip_html_tags at 0x7f77a7c3f7f0>
  File "apps/frappe/frappe/__init__.py", line 444, in _raise_exception
    raise raise_exception(msg)
      inspect = <module 'inspect' from '/usr/lib/python3.10/inspect.py'>
      msg = 'Row 3: Both Debit and Credit values cannot be zero'
      raise_exception = <class 'frappe.exceptions.ValidationError'>
frappe.exceptions.ValidationError: Row 3: Both Debit and Credit values cannot be zero

maveezmh avatar Sep 17 '22 14:09 maveezmh