frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.92k stars 7.34k forks source link

Salary Slip #39946

Closed bhavyajicomputers closed 4 months ago

bhavyajicomputers commented 9 months ago

Information about bug

Error when salary slip submitted image

Module

HR

Version

"erpnext": "15.14.0", "frappe": "15.14.0", "hrms": "15.11.1", "india_compliance": "15.5.1", "insights": "2.1.0", "payments": "0.0.1"

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "erpnext": "15.14.0",
    "frappe": "15.14.0",
    "hrms": "15.11.1",
    "india_compliance": "15.5.1",
    "insights": "2.1.0",
    "payments": "0.0.1"
}

Route

Form/Salary Slip/Sal Slip/HR-EMP-00009/00001

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1682, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 37, in savedocs
    doc.submit()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1026, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1009, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 332, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 385, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1109, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 940, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1300, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1282, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 937, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 193, in on_submit
    self.email_salary_slip()
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 1828, in email_salary_slip
    password = generate_password_for_pdf(payroll_settings.password_policy, self.employee)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/payroll/doctype/salary_slip/salary_slip.py", line 2056, in generate_password_for_pdf
    return policy_template.format(**employee.as_dict())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Single '}' encountered in format string

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"name\":\"Sal Slip/HR-EMP-00009/00001\",\"owner\":\"Administrator\",\"creation\":\"2024-02-17 15:40:16.049679\",\"modified\":\"2024-02-17 16:03:41.896711\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"employee\":\"HR-EMP-00009\",\"employee_name\":\"MAUSAMI PATHAK\",\"department\":\"Sales\",\"designation\":\"Facility In-charge\",\"branch\":\"LES- Crown\",\"posting_date\":\"2023-06-30\",\"letter_head\":\"BCPL-Letter Head\",\"status\":\"Draft\",\"company\":\"Bhavyaji Computers Pvt Ltd\",\"currency\":\"INR\",\"exchange_rate\":1,\"payroll_frequency\":\"Monthly\",\"start_date\":\"2023-06-01\",\"end_date\":\"2023-06-30\",\"salary_structure\":\"Store -Manager\",\"payroll_entry\":\"HR-PRUN-2024-00000\",\"mode_of_payment\":\"Cash\",\"salary_slip_based_on_timesheet\":0,\"deduct_tax_for_unclaimed_employee_benefits\":0,\"deduct_tax_for_unsubmitted_tax_exemption_proof\":0,\"total_working_days\":30,\"unmarked_days\":0,\"leave_without_pay\":0,\"absent_days\":0,\"payment_days\":30,\"total_working_hours\":0,\"hour_rate\":0,\"base_hour_rate\":0,\"gross_pay\":25000,\"base_gross_pay\":25000,\"gross_year_to_date\":25000,\"base_gross_year_to_date\":0,\"total_deduction\":0,\"base_total_deduction\":0,\"net_pay\":25000,\"base_net_pay\":25000,\"rounded_total\":25000,\"base_rounded_total\":25000,\"year_to_date\":25000,\"base_year_to_date\":0,\"month_to_date\":25000,\"base_month_to_date\":0,\"total_in_words\":\"INR Twenty Five Thousand only.\",\"base_total_in_words\":\"INR Twenty Five Thousand only.\",\"ctc\":0,\"income_from_other_sources\":0,\"total_earnings\":0,\"non_taxable_earnings\":0,\"standard_tax_exemption_amount\":0,\"tax_exemption_declaration\":0,\"deductions_before_tax_calculation\":0,\"annual_taxable_amount\":0,\"income_tax_deducted_till_date\":0,\"current_month_income_tax\":0,\"future_income_tax_deductions\":0,\"total_income_tax\":0,\"doctype\":\"Salary Slip\",\"earnings\":[{\"name\":\"1e657ce614\",\"owner\":\"Administrator\",\"creation\":\"2024-02-17 15:40:16.049679\",\"modified\":\"2024-02-17 16:03:41.896711\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"salary_component\":\"Basic\",\"abbr\":\"B\",\"amount\":15000,\"year_to_date\":15000,\"is_recurring_additional_salary\":0,\"statistical_component\":0,\"depends_on_payment_days\":1,\"exempted_from_income_tax\":0,\"is_tax_applicable\":1,\"is_flexible_benefit\":0,\"variable_based_on_taxable_salary\":0,\"do_not_include_in_total\":0,\"deduct_full_tax_on_selected_payroll_date\":0,\"amount_based_on_formula\":0,\"default_amount\":15000,\"additional_amount\":0,\"tax_on_flexible_benefit\":0,\"tax_on_additional_salary\":0,\"parent\":\"Sal Slip/HR-EMP-00009/00001\",\"parentfield\":\"earnings\",\"parenttype\":\"Salary Slip\",\"doctype\":\"Salary Detail\"},{\"name\":\"2c9e79241c\",\"owner\":\"Administrator\",\"creation\":\"2024-02-17 15:40:16.049679\",\"modified\":\"2024-02-17 16:03:41.896711\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":2,\"salary_component\":\"House Rent Allowance\",\"abbr\":\"HRA\",\"amount\":6000,\"year_to_date\":6000,\"is_recurring_additional_salary\":0,\"statistical_component\":0,\"depends_on_payment_days\":1,\"exempted_from_income_tax\":0,\"is_tax_applicable\":1,\"is_flexible_benefit\":0,\"variable_based_on_taxable_salary\":0,\"do_not_include_in_total\":0,\"deduct_full_tax_on_selected_payroll_date\":0,\"amount_based_on_formula\":0,\"default_amount\":6000,\"additional_amount\":0,\"tax_on_flexible_benefit\":0,\"tax_on_additional_salary\":0,\"parent\":\"Sal Slip/HR-EMP-00009/00001\",\"parentfield\":\"earnings\",\"parenttype\":\"Salary Slip\",\"doctype\":\"Salary Detail\"},{\"name\":\"67591c80ac\",\"owner\":\"Administrator\",\"creation\":\"2024-02-17 15:40:16.049679\",\"modified\":\"2024-02-17 16:03:41.896711\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":3,\"salary_component\":\"CONVEYANCE & COMMUNICATION\",\"abbr\":\"cc\",\"amount\":1000,\"year_to_date\":1000,\"is_recurring_additional_salary\":0,\"statistical_component\":0,\"depends_on_payment_days\":1,\"exempted_from_income_tax\":0,\"is_tax_applicable\":1,\"is_flexible_benefit\":0,\"variable_based_on_taxable_salary\":0,\"do_not_include_in_total\":0,\"deduct_full_tax_on_selected_payroll_date\":0,\"amount_based_on_formula\":0,\"default_amount\":1000,\"additional_amount\":0,\"tax_on_flexible_benefit\":0,\"tax_on_additional_salary\":0,\"parent\":\"Sal Slip/HR-EMP-00009/00001\",\"parentfield\":\"earnings\",\"parenttype\":\"Salary Slip\",\"doctype\":\"Salary Detail\"},{\"name\":\"e1181ab0d5\",\"owner\":\"Administrator\",\"creation\":\"2024-02-17 15:40:16.049679\",\"modified\":\"2024-02-17 16:03:41.896711\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":4,\"salary_component\":\"Special Allowance\",\"abbr\":\"sa\",\"amount\":3000,\"year_to_date\":3000,\"is_recurring_additional_salary\":0,\"statistical_component\":0,\"depends_on_payment_days\":1,\"exempted_from_income_tax\":0,\"is_tax_applicable\":1,\"is_flexible_benefit\":0,\"variable_based_on_taxable_salary\":0,\"do_not_include_in_total\":0,\"deduct_full_tax_on_selected_payroll_date\":0,\"amount_based_on_formula\":0,\"default_amount\":3000,\"additional_amount\":0,\"tax_on_flexible_benefit\":0,\"tax_on_additional_salary\":0,\"parent\":\"Sal Slip/HR-EMP-00009/00001\",\"parentfield\":\"earnings\",\"parenttype\":\"Salary Slip\",\"doctype\":\"Salary Detail\"}],\"deductions\":[],\"timesheets\":[],\"leave_details\":[],\"__last_sync_on\":\"2024-02-17T13:18:29.220Z\"}",
        "action": "Submit"
    },
    "btn": {
        "jQuery370093576337338364391": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 26451,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": "71f7eb78-b5c9-416f-9a72-0c1b806314e9"
}

Response Data

{
    "exception": "ValueError: Single '}' encountered in format string",
    "exc_type": "ValueError",
    "_exc_source": "hrms (app)"
}
Nihantra-Patel commented 4 months ago

Kindly upgrade your version 15 because everything is working fine. No problems were encountered in the latest version 15.