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

Payroll Entry - ValueError - too many values to unpack (expected 2) #24047

Closed
centaur78 opened this issue Dec 3, 2020 · 4 comments · Fixed by #25705
Closed

Payroll Entry - ValueError - too many values to unpack (expected 2) #24047

centaur78 opened this issue Dec 3, 2020 · 4 comments · Fixed by #25705
Labels

Comments

@centaur78
Copy link

Hi @Anurag810

I am unable to submit the Salary slip after updating to this PR #23173 .

salary_slip error

Below is the traceback

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 64, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 58, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 30, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 70, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1112, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 19, in savedocs
    doc.submit()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 918, in submit
    self._submit()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 907, in _submit
    self.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 285, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 337, in _save
    self.run_post_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 984, in run_post_save_methods
    self.run_method("on_submit")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 848, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1133, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1116, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 842, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/payroll/doctype/payroll_entry/payroll_entry.py", line 25, in on_submit
    self.create_salary_slips()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/payroll/doctype/payroll_entry/payroll_entry.py", line 147, in create_salary_slips
    create_salary_slips_for_employees(emp_list, args, publish_progress=False)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/payroll/doctype/payroll_entry/payroll_entry.py", line 536, in create_salary_slips_for_employees
    ss.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 238, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 947, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 848, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1133, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1116, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 842, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/payroll/doctype/salary_slip/salary_slip.py", line 47, in validate
    self.get_emp_and_working_day_details()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/payroll/doctype/salary_slip/salary_slip.py", line 143, in get_emp_and_working_day_details
    payroll_based_on, consider_unmarked_attendance_as = frappe.db.get_value("Payroll Settings", None, ["payroll_based_on","consider_unmarked_attendance_as"])
ValueError: too many values to unpack (expected 2)
@centaur78 centaur78 added the bug label Dec 3, 2020
@Anurag810
Copy link
Contributor

@centaur78 thanks for reporting we will push fixes on priority.

@Anurag810
Copy link
Contributor

@centaur78 I tried to replicate the issue locally but it is working fine for me.

@centaur78
Copy link
Author

@centaur78 I tried to replicate the issue locally but it is working fine for me.

Hi @Anurag810

I am on the develop branch.

I just did
bench update --reset
bench clear-cache
bench restart

Still the same issue as soon as I click "Get Salary Slip"

salary_slip error 2

Prior to the PR #23173, it was working without this issue. Not sure if any other connected PR is causing this ??

@centaur78
Copy link
Author

Hi @Anurag810

Now going through the changed code of the PR... It looks like there is something called Payroll Settings which needs to be set.

Strange couldn't find it anywhere in the settings menu or other places. Had to do a search to find.

Finally after setting the details below. I am able to submit the salary slip.

payroll_settings

It would really nice if you guys can mentioned in the Documentation /Manual regarding this

Closing issue.

@Anurag810 Anurag810 linked a pull request Jun 21, 2021 that will close this issue
3 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants