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

Getting Error if I click on “Mark Attendance” in Shift Type #1739

Open
ZeshanArif27 opened this issue May 1, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ZeshanArif27
Copy link

Information about bug

Information about bug

AttributeError: ‘NoneType’ object has no attribute ‘date’
Possible source of error: hrms (app)

The attendance button worked worked just Fine for my other shifts but on a specific shift its giving the error

It worked just fine on the below shift
Screenshot (18)

But Its giving error on this shift
Screenshot (19)

Is this a bug? Is there a workaround available? Or I am Doing something wrong?

Best regards
M. Zeeshan Baig
Module

HR Version

erpnext 16.0.0-dev
frappe 15.22.0
hrms 16.0.0-dev

Installation method

Manual

Relevant log output / Stack trace / Full Error Message.

AttributeError: ‘NoneType’ object has no attribute ‘date’
Possible source of error: hrms (app)

Below is the whole error which I copied to the clipboard

Module

HR

Version

App Versions

{
	"erpnext": "16.0.0-dev",
	"frappe": "15.22.0",
	"hrms": "16.0.0-dev",
	"print_designer": "1.0.0",
	"whitelabel": "0.0.1"
}

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

### Route

Form/Shift Type/Office Timing

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 1718, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 326, in run_doc_method
    response = doc.run_method(method)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/shift_type/shift_type.py", line 41, in process_auto_attendance
    attendance_date = key[1].date()
                      ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'date'

Request Data

{
	"type": "POST",
	"args": {
		"docs": "{\"name\":\"Office Timing\",\"owner\":\"wajeeh@mmcgbl.com\",\"creation\":\"2024-04-17 15:13:45.907249\",\"modified\":\"2024-05-01 19:34:38.141075\",\"modified_by\":\"wajeeh@mmcgbl.com\",\"docstatus\":0,\"idx\":21140,\"start_time\":\"10:00:00\",\"end_time\":\"19:00:00\",\"holiday_list\":\"Pakistan National Holidays\",\"enable_auto_attendance\":1,\"determine_check_in_and_check_out\":\"Alternating entries as IN and OUT during the same shift\",\"working_hours_calculation_based_on\":\"First Check-in and Last Check-out\",\"begin_check_in_before_shift_start_time\":60,\"allow_check_out_after_shift_end_time\":259,\"mark_auto_attendance_on_holidays\":1,\"working_hours_threshold_for_half_day\":5,\"working_hours_threshold_for_absent\":0,\"process_attendance_after\":\"2024-03-01\",\"last_sync_of_checkin\":\"2024-03-10 23:59:59\",\"enable_late_entry_marking\":1,\"late_entry_grace_period\":30,\"enable_early_exit_marking\":1,\"early_exit_grace_period\":60,\"doctype\":\"Shift Type\"}",
		"method": "process_auto_attendance"
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/run_doc_method",
	"request_id": null
}

Response Data

{
	"exception": "AttributeError: 'NoneType' object has no attribute 'date'",
	"exc_type": "AttributeError",
	"_exc_source": "hrms (app)"
}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@ZeshanArif27 ZeshanArif27 added the bug Something isn't working label May 1, 2024
@zaheer-srushty
Copy link
Contributor

Have you assigned the Shift to Employees? Can you show me that result?

@Dharanipath1
Copy link

This occurs when there is no data in the 'shift_time' field in the employee check-in. Please verify the 'employee checkin
doctype

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants