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

'list' object has no attribute 'lower' #2548

Open
1 task done
njbhatt18 opened this issue Dec 24, 2024 · 2 comments
Open
1 task done

'list' object has no attribute 'lower' #2548

njbhatt18 opened this issue Dec 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@njbhatt18
Copy link

Information about bug

Reported Error In Leave Module

Module

HR

Version

ERPNext: v15.46.2 (version-15)
Frappe Framework: v15.50.1 (version-15)
Frappe HR: v15.36.1 (version-15)
India Compliance: v15.14.6 (version-15)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

Traceback with variables (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
      request = <Request 'https://erp.techseria.com/api/method/hrms.hr.doctype.leave_application.leave_application.get_events?doctype=Leave%20Application&start=2024-11-25%2000:00:00&end=2025-01-06%2000:00:00&filters=["Leave%20Application","name","=","HR-EMP-00010"]&field_map={"start":"from_date","end":"to_date","id":"name","title":"title","docstatus":1,"color":"color"}' [GET]>
      response = None
      rollback = True
      e = AttributeError("'list' object has no attribute 'lower'")
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
      request = <Request 'https://erp.techseria.com/api/method/hrms.hr.doctype.leave_application.leave_application.get_events?doctype=Leave%20Application&start=2024-11-25%2000:00:00&end=2025-01-06%2000:00:00&filters=["Leave%20Application","name","=","HR-EMP-00010"]&field_map={"start":"from_date","end":"to_date","id":"name","title":"title","docstatus":1,"color":"color"}' [GET]>
      endpoint = <function handle_rpc_call at 0xf52d27420d60>
      arguments = {'method': 'hrms.hr.doctype.leave_application.leave_application.get_events'}
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
      method = 'hrms.hr.doctype.leave_application.leave_application.get_events'
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
  File "apps/frappe/frappe/handler.py", line 50, in handle
    data = execute_cmd(cmd)
      cmd = 'hrms.hr.doctype.leave_application.leave_application.get_events'
      data = None
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
      cmd = 'hrms.hr.doctype.leave_application.leave_application.get_events'
      from_async = False
      server_script = None
      method = <function get_events at 0xf52d1c398860>
  File "apps/frappe/frappe/__init__.py", line 1726, in call
    return fn(*args, **newargs)
      fn = <function get_events at 0xf52d1c398860>
      args = ()
      kwargs = {'doctype': 'Leave Application', 'start': '2024-11-25 00:00:00', 'end': '2025-01-06 00:00:00', 'filters': '["Leave Application","name","=","HR-EMP-00010"]', 'field_map': '{"start":"from_date","end":"to_date","id":"name","title":"title","docstatus":1,"color":"color"}', 'cmd': 'hrms.hr.doctype.leave_application.leave_application.get_events'}
      newargs = {'start': '2024-11-25 00:00:00', 'end': '2025-01-06 00:00:00', 'filters': '["Leave Application","name","=","HR-EMP-00010"]'}
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
      args = ()
      kwargs = {'start': '2024-11-25 00:00:00', 'end': '2025-01-06 00:00:00', 'filters': '["Leave Application","name","=","HR-EMP-00010"]'}
      apply_condition = <function whitelist.<locals>.innerfn.<locals>.<lambda> at 0xf52d1c3987c0>
      func = <function get_events at 0xf52d1c398720>
  File "apps/hrms/hrms/hr/doctype/leave_application/leave_application.py", line 1202, in get_events
    add_leaves(events, start, end, filters)
      start = '2024-11-25 00:00:00'
      end = '2025-01-06 00:00:00'
      filters = ['eave Applicatio', 'am', '', 'R-EMP-0001', ['from_date', '<=', datetime.date(2025, 1, 6)], ['to_date', '>=', datetime.date(2024, 11, 25)], ['status', 'in', ['Approved', 'Open']], ['docstatus', '<', 2]]
      json = <module 'json' from '/usr/lib/python3.11/json/__init__.py'>
      idx = 3
      filter = 'HR-EMP-00010'
      events = [{'name': 'HR-LAP-2024-00276', 'from_date': datetime.date(2024, 12, 6), 'to_date': datetime.date(2024, 12, 6), 'color': None, 'docstatus': 1, 'allDay': 1, 'doctype': 'Leave Application', 'title': 'Lalit Patel (Casual Leave)'}]
      employee = 'HR-EMP-00010'
      company = 'Techseria Private Limited'
  File "apps/hrms/hrms/hr/doctype/leave_application/leave_application.py", line 1248, in add_leaves
    leave_applications = frappe.get_list("Leave Application", filters=filters, fields=fields)
      events = [{'name': 'HR-LAP-2024-00276', 'from_date': datetime.date(2024, 12, 6), 'to_date': datetime.date(2024, 12, 6), 'color': None, 'docstatus': 1, 'allDay': 1, 'doctype': 'Leave Application', 'title': 'Lalit Patel (Casual Leave)'}]
      start = '2024-11-25 00:00:00'
      end = '2025-01-06 00:00:00'
      filters = ['eave Applicatio', 'am', '', 'R-EMP-0001', ['from_date', '<=', datetime.date(2025, 1, 6)], ['to_date', '>=', datetime.date(2024, 11, 25)], ['status', 'in', ['Approved', 'Open']], ['docstatus', '<', 2]]
      fields = ['name', 'from_date', 'to_date', 'color', 'docstatus', 'employee_name', 'leave_type', '(1) as allDay', "'Leave Application' as doctype"]
      show_leaves_of_all_members = 0
  File "apps/frappe/frappe/__init__.py", line 1990, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
      doctype = 'Leave Application'
      args = ()
      kwargs = {'filters': ['eave Applicatio', 'am', '', 'R-EMP-0001', ['from_date', '<=', datetime.date(2025, 1, 6)], ['to_date', '>=', datetime.date(2024, 11, 25)], ['status', 'in', ['Approved', 'Open']], ['docstatus', '<', 2]], 'fields': ['name', 'from_date', 'to_date', 'color', 'docstatus', 'employee_name', 'leave_type', '(1) as allDay', "'Leave Application' as doctype"]}
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
  File "apps/frappe/frappe/model/db_query.py", line 191, in execute
    result = self.build_and_run()
      self = <frappe.model.db_query.DatabaseQuery object at 0xf52d1c7fa950>
      fields = ['eave Applicatio', 'am', '', 'R-EMP-0001', ['from_date', '<=', datetime.date(2025, 1, 6)], ['to_date', '>=', datetime.date(2024, 11, 25)], ['status', 'in', ['Approved', 'Open']], ['docstatus', '<', 2]]
      filters = ['name', 'from_date', 'to_date', 'color', 'docstatus', 'employee_name', 'leave_type', '(1) as allDay', "'Leave Application' as doctype"]
      or_filters = None
      docstatus = None
      group_by = None
      order_by = 'KEEP_DEFAULT_ORDERING'
      limit_start = False
      limit_page_length = None
      as_list = False
      with_childnames = False
      debug = False
      ignore_permissions = False
      user = None
      with_comment_count = False
      join = 'left join'
      distinct = False
      start = None
      page_length = None
      limit = None
      ignore_ifnull = False
      save_user_settings = False
      save_user_settings_fields = False
      update = None
      add_total_row = None
      user_settings = None
      reference_doctype = None
      run = True
      strict = True
      pluck = None
      ignore_ddl = False
      parent_doctype = None
  File "apps/frappe/frappe/model/db_query.py", line 206, in build_and_run
    args = self.prepare_args()
      self = <frappe.model.db_query.DatabaseQuery object at 0xf52d1c7fa950>
  File "apps/frappe/frappe/model/db_query.py", line 243, in prepare_args
    self.sanitize_fields()
      self = <frappe.model.db_query.DatabaseQuery object at 0xf52d1c7fa950>
  File "apps/frappe/frappe/model/db_query.py", line 413, in sanitize_fields
    lower_field = field.lower().strip()
      self = <frappe.model.db_query.DatabaseQuery object at 0xf52d1c7fa950>
      blacklisted_keywords = ********
      blacklisted_functions = ['concat', 'concat_ws', 'if', 'ifnull', 'nullif', 'coalesce', 'connection_id', 'current_user', 'database', 'last_insert_id', 'session_user', 'system_user', 'user', 'version', 'global']
      _is_query = <function DatabaseQuery.sanitize_fields.<locals>._is_query at 0xf52d1c094400>
      field = ['from_date', '<=', datetime.date(2025, 1, 6)]
      lower_field = 'r-emp-0001'
      _raise_exception = <function DatabaseQuery.sanitize_fields.<locals>._raise_exception at 0xf52d1c094180>
builtins.AttributeError: 'list' object has no attribute 'lower'

Code of Conduct

  • I agree to follow this project's Code of Conduct
@njbhatt18 njbhatt18 added the bug Something isn't working label Dec 24, 2024
@creative-paramu
Copy link
Contributor

Could you please upload the picture of the error?

@njbhatt18
Copy link
Author

reported error is showing in error log 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

2 participants