8848digital / hrms

Open Source HR and Payroll Software
https://frappe.io/hr
GNU General Public License v3.0
0 stars 1 forks source link

Server Error while saving Employee Check-in #13

Closed balamurugan8848 closed 1 week ago

balamurugan8848 commented 2 weeks ago

Information about bug

While creating and saving the Employee Checkin there is a server error

Image

Module

HR

Version

Frappe HR: v15.36.1 (pre-prod) ERPNext: v15.50.0 (pre-prod) Frappe Framework: v15.52.0 (pre-prod)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "assets": "0.0.1",
    "crm": "2.0.0-dev",
    "custom_crm": "0.0.1",
    "erpnext": "15.50.0",
    "erpnext_india": "0.0.1",
    "exotel_integration": "0.0.1",
    "frappe": "15.52.0",
    "helpdesk": "1.4.0",
    "hr_addon": "0.0.1",
    "hrms": "15.36.1",
    "india_compliance": "15.15.0",
    "insights": "3.0.0",
    "payments": "0.0.1",
    "print_designer": "1.4.3",
    "projects": "0.0.1",
    "sales_commission": "0.0.1",
    "transportation": "0.0.1"
}

### Route

Form/Employee Checkin/new-employee-checkin-rdwxsutdjp

### Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, 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 50, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1758, 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 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 345, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 367, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 298, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1106, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 977, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1337, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1319, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 974, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/employee_checkin/employee_checkin.py", line 26, in validate
    self.fetch_shift()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/employee_checkin/employee_checkin.py", line 53, in fetch_shift
    shift_actual_timings := get_actual_start_end_datetime_of_shift(
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 556, in get_actual_start_end_datetime_of_shift
    shift_timings_as_per_timestamp = get_employee_shift_timings(
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 501, in get_employee_shift_timings
    curr_shift = get_employee_shift(employee, for_timestamp, consider_default_shift, "forward")
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 422, in get_employee_shift
    shift_details = get_shift_for_timestamp(employee, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 402, in get_shift_for_timestamp
    return get_shift_for_time(shifts, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 264, in get_shift_for_time
    shift_details = get_shift_details(assignment.shift_type, for_timestamp=for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 593, in get_shift_details
    start_datetime, end_datetime = get_shift_timings(shift_type, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 629, in get_shift_timings
    datetime.combine(for_timestamp, datetime.min.time())
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.time'

### Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"docstatus\":0,\"doctype\":\"Employee Checkin\",\"name\":\"new-employee-checkin-rdwxsutdjp\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"log_type\":\"OUT\",\"time\":\"2025-03-04 18:43:36\",\"skip_auto_attendance\":0,\"employee_name\":\"Deepa\",\"employee\":\"HR-EMP-00002\"}",
        "action": "Save"
    },
    "btn": {
        "jQuery370055110755339778961": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 385,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": null
}

### Response Data

{
    "exception": "TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.time'",
    "exc_type": "TypeError",
    "_exc_source": "hrms (app)"
}
balamurugan8848 commented 2 weeks ago

@hrishikesh8848 @Satya8848

hrishikesh8848 commented 1 week ago

@balamurugan8848 this is fixed

balamurugan8848 commented 1 week ago

@hrishikesh8848 the issue is still there while saving please check.

Image

App Versions

{
    "assets": "0.0.1",
    "crm": "2.0.0-dev",
    "custom_crm": "0.0.1",
    "erpnext": "15.50.0",
    "erpnext_india": "0.0.1",
    "exotel_integration": "0.0.1",
    "frappe": "15.52.0",
    "helpdesk": "1.4.0",
    "hr_addon": "0.0.1",
    "hrms": "15.36.1",
    "india_compliance": "15.15.0",
    "insights": "3.0.0",
    "payments": "0.0.1",
    "print_designer": "1.4.3",
    "projects": "0.0.1",
    "sales_commission": "0.0.1",
    "transportation": "0.0.1"
}

Route

Form/Employee Checkin/new-employee-checkin-ngyaaqjfbu

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, 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 50, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1758, 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 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 345, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 367, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 298, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1106, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 977, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1337, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1319, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 974, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/employee_checkin/employee_checkin.py", line 26, in validate
    self.fetch_shift()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/employee_checkin/employee_checkin.py", line 53, in fetch_shift
    shift_actual_timings := get_actual_start_end_datetime_of_shift(
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 556, in get_actual_start_end_datetime_of_shift
    shift_timings_as_per_timestamp = get_employee_shift_timings(
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 501, in get_employee_shift_timings
    curr_shift = get_employee_shift(employee, for_timestamp, consider_default_shift, "forward")
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 422, in get_employee_shift
    shift_details = get_shift_for_timestamp(employee, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 402, in get_shift_for_timestamp
    return get_shift_for_time(shifts, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 264, in get_shift_for_time
    shift_details = get_shift_details(assignment.shift_type, for_timestamp=for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 593, in get_shift_details
    start_datetime, end_datetime = get_shift_timings(shift_type, for_timestamp)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 628, in get_shift_timings
    datetime.combine(for_timestamp.date(), datetime.min.time())
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.time'

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"docstatus\":0,\"doctype\":\"Employee Checkin\",\"name\":\"new-employee-checkin-aprodosrsl\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"log_type\":\"IN\",\"time\":\"2025-03-11 09:30:00\",\"skip_auto_attendance\":0,\"__run_link_triggers\":false,\"employee\":\"HR-EMP-00001\",\"employee_name\":\"Johnson Fernandes\",\"latitude\":0,\"longitude\":0,\"custom_api_id\":0,\"creation\":\"\",\"modified_by\":\"Administrator\",\"modified\":\"\",\"lft\":null,\"rgt\":null,\"idx\":null}",
        "action": "Save"
    },
    "btn": {
        "jQuery370028836466989142261": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 2842,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": null
}

Response Data

{
    "exception": "TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.time'",
    "exc_type": "TypeError",
    "_exc_source": "hrms (app)"
}
balamurugan8848 commented 1 week ago

@hrishikesh8848 this is working fine. Closing this issue.