Adding new status for attendance

Hi there!
I want to add some status for attendance like work from home… but I see they hard code the options to validate_status
Is there any way to get options from doctype to pass to validate_status function?

Thank you for supporting!!!

The code can be made versatile to allow status to be changed and new status to be added. Although, in the list view green indicator will only be visible for present status.

Is there any way to get options from doctype to pass to validate_status function in sever side?
Or I have to change options list manually?

https://github.com/frappe/erpnext/pull/15769

1 Like

Many thank @Zlash65.

@Zlash65: I fail test in pull request all the time.
https://github.com/frappe/erpnext/pull/15757
ImportError: Module import failed for Subscriber (frappe.core.doctype.subscriber.subscriber Error: No module named subscriber.subscriber)
How can i get rid of it?
Thank you very much.

https://github.com/frappe/erpnext/pull/15766

Its already been fixed in the staging-fixes branch and will be released into develop in some time. After thats done, you can rebase your pr with the latest develop branch and get the fix for failing tests.

1 Like

Oh Thank you! @Zlash65

My test result:

  1. Customize form

  2. Add “Sick” to the Status field

  3. Create new Attendance with the “Sick” status

  4. Open Monthly Attendance Sheet Report

  5. Error pop up:

    Traceback (most recent call last):
    File “/opt/bench/erpnext/apps/frappe/frappe/app.py”, line 61, in application
    response = frappe.handler.handle()
    File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 21, in handle
    data = execute_cmd(cmd)
    File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
    File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1007, in call
    return fn(*args, **newargs)
    File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 489, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
    File “/opt/bench/erpnext/apps/frappe/frappe/desk/query_report.py”, line 174, in run
    result = generate_report_result(report, filters, user)
    File “/opt/bench/erpnext/apps/frappe/frappe/desk/query_report.py”, line 65, in generate_report_result
    res = frappe.get_attr(method_name)(frappe._dict(filters))
    File “/opt/bench/erpnext/apps/erpnext/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py”, line 45, in execute
    row.append(status_map[status])
    KeyError: u’Sick’

How to manage custom status without touching the code?

Thanks.

@Ahmad_Mardianto I think can not because they hard code a array for status and check exits on this

1 Like

I have the same question…is there a possibility to do that in attendance tool… can another field be added as work from. Due to pandemic, I think this field is very important.
Thankyou.

Hy guys, I have the same problem. The pop up error seems to have been “clarified”, but still doesn’t working :
image

Did someone identified some solution ?
How can i have access to the hard code ?

Thanks in advance.

Thanks to @flexy2ky, for sharing helpfull guide in details.
@v_schill, I am not recommending to entertain with core file. please use custom app and override the doctype with as per your need.
Here is the thread link that you are looking for. Hope this will help.

@Suresh_Thakor , @flexy2ky many thanks for your help! I’ll try this solution.