Error when submitting 'expense claim'

Hi

I get a server error when submitting expense claim. It was okay before the update (frappe HR). Here are the logs

Server Error

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

App Versions

{
	"erpnext": "15.72.3",
	"frappe": "15.75.0",
	"hrms": "16.0.0-dev"
}

Route

Form/Expense Claim/HR-EXP-2025-00031

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 115, 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 51, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 84, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1754, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, 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 32, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1093, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1076, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 378, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 431, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1176, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 1007, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1367, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1349, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1004, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 143, in on_submit
    update_reimbursed_amount(self)
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 408, in update_reimbursed_amount
    total_amount_reimbursed = get_total_reimbursed_amount(doc)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 430, in get_total_reimbursed_amount
    amount_via_payment_entry = frappe.db.get_value(
                               ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 514, in get_value
    result = self.get_values(
             ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 618, in get_values
    out = self._get_values_from_table(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 876, in _get_values_from_table
    query = frappe.qb.get_query(
            ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/query_builder/utils.py", line 61, in get_query
    return Engine().get_query(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 74, in get_query
    self.apply_fields(fields)
  File "apps/frappe/frappe/database/query.py", line 102, in apply_fields
    self.fields = self.parse_fields(fields)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 323, in parse_fields
    _fields.append(ChildQuery(child_field, fields, self.doctype))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 488, in __init__
    if field.fieldtype not in frappe.model.table_fields:
       ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'fieldtype'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"HR-EXP-2025-00031\",\"owner\":\"Administrator\",\"creation\":\"2025-07-16 00:09:37.731869\",\"modified\":\"2025-08-04 18:08:09.544815\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"naming_series\":\"HR-EXP-.YYYY.-\",\"employee\":\"HR-EMP-00002\",\"employee_name\":\"Ed\",\"department\":\"Management\",\"company\":\"Ed Holdings\",\"expense_approver\":\"Administrator\",\"approval_status\":\"Approved\",\"total_sanctioned_amount\":63,\"total_taxes_and_charges\":0,\"total_advance_amount\":0,\"grand_total\":63,\"total_claimed_amount\":63,\"total_amount_reimbursed\":0,\"posting_date\":\"2025-06-24\",\"is_paid\":0,\"payable_account\":\"Creditors - OOH\",\"remark\":\"None\",\"cost_center\":\"Main - OOH\",\"status\":\"Draft\",\"doctype\":\"Expense Claim\",\"expenses\":[{\"name\":\"u8nii9c0\",\"owner\":\"Administrator\",\"creation\":\"2025-07-16 00:09:37.731869\",\"modified\":\"2025-08-04 18:08:09.544815\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"expense_date\":\"2025-06-23\",\"expense_type\":\"Medical/Clinic\",\"default_account\":\"Administrative Expenses - OOHSB\",\"description\":\"<div class=\\\"ql-editor read-mode\\\"><p><br></p></div>\",\"amount\":63,\"sanctioned_amount\":63,\"cost_center\":\"Main - OOH\",\"parent\":\"HR-EXP-2025-00031\",\"parentfield\":\"expenses\",\"parenttype\":\"Expense Claim\",\"doctype\":\"Expense Claim Detail\"}],\"advances\":[],\"taxes\":[],\"__onload\":{\"make_payment_via_journal_entry\":0,\"self_expense_approval_not_allowed\":0},\"__last_sync_on\":\"2025-08-05T09:45:41.993Z\"}",
		"action": "Submit"
	},
	"btn": {
		"jQuery370048413931374136531": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 657,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

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

no update on this?

1 Like

We are facing the same issue, i wonder how did you solved it .

can you show the exact error

cannot solve it, still hanging.

1 Like

the exact error is on my first post

1 Like

App Versions

{
	"diagnostic_app": "0.0.1",
	"dobiz_app": "0.0.1",
	"erpnext": "15.76.0",
	"frappe": "15.78.1",
	"hrms": "16.0.0-dev",
	"ksa": "0.0.1",
	"ksa_compliance": "0.55.3",
	"print_designer": "1.0.0-dev"
}

Route

Form/Expense Claim/HR-EXP-2025-00001

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 115, 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 52, 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 1754, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, 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 32, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1093, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1076, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 378, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 431, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1176, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 1007, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1367, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1349, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1004, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 143, in on_submit
    update_reimbursed_amount(self)
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 408, in update_reimbursed_amount
    total_amount_reimbursed = get_total_reimbursed_amount(doc)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 430, in get_total_reimbursed_amount
    amount_via_payment_entry = frappe.db.get_value(
                               ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 514, in get_value
    result = self.get_values(
             ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 618, in get_values
    out = self._get_values_from_table(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/database.py", line 876, in _get_values_from_table
    query = frappe.qb.get_query(
            ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/query_builder/utils.py", line 61, in get_query
    return Engine().get_query(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 74, in get_query
    self.apply_fields(fields)
  File "apps/frappe/frappe/database/query.py", line 102, in apply_fields
    self.fields = self.parse_fields(fields)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 323, in parse_fields
    _fields.append(ChildQuery(child_field, fields, self.doctype))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/database/query.py", line 488, in __init__
    if field.fieldtype not in frappe.model.table_fields:
       ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'fieldtype'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"HR-EXP-2025-00001\",\"owner\":\"Administrator\",\"creation\":\"2025-10-13 10:43:47.778535\",\"modified\":\"2025-10-15 12:01:13.331261\",\"modified_by\":\"a.fagir@grcarabia.consulting\",\"docstatus\":0,\"idx\":0,\"naming_series\":\"HR-EXP-.YYYY.-\",\"employee\":\"HR-EMP-00002\",\"employee_name\":\"Ayman Fagir\",\"department\":\"الإدارة\",\"company\":\"GRC Consulting\",\"expense_approver\":\"a.fagir@grcarabia.consulting\",\"approval_status\":\"Approved\",\"total_sanctioned_amount\":125,\"total_taxes_and_charges\":18.75,\"total_advance_amount\":0,\"grand_total\":143.75,\"total_claimed_amount\":125,\"total_amount_reimbursed\":0,\"posting_date\":\"2025-10-13\",\"is_paid\":0,\"payable_account\":\"2110 - الدائنين - GRC\",\"remark\":\"a\",\"project\":\"PROJ-0001\",\"cost_center\":\"رئيسي - GRC\",\"status\":\"Draft\",\"doctype\":\"Expense Claim\",\"advances\":[],\"taxes\":[{\"name\":\"n3tb6a69fc\",\"owner\":\"a.fagir@grcarabia.consulting\",\"creation\":\"2025-10-13 10:43:47.778535\",\"modified\":\"2025-10-15 12:01:13.331261\",\"modified_by\":\"a.fagir@grcarabia.consulting\",\"docstatus\":0,\"idx\":1,\"account_head\":\"ضريبة القيمة المضافة - GRC\",\"rate\":15,\"tax_amount\":18.75,\"total\":143.75,\"description\":\"ضريبة القيمة المضافة\",\"cost_center\":\"رئيسي - GRC\",\"parent\":\"HR-EXP-2025-00001\",\"parentfield\":\"taxes\",\"parenttype\":\"Expense Claim\",\"doctype\":\"Expense Taxes and Charges\"}],\"expenses\":[{\"name\":\"i85m1vrjlq\",\"owner\":\"Administrator\",\"creation\":\"2025-10-13 10:43:47.778535\",\"modified\":\"2025-10-15 12:01:13.331261\",\"modified_by\":\"a.fagir@grcarabia.consulting\",\"docstatus\":0,\"idx\":1,\"expense_date\":\"2025-10-13\",\"expense_type\":\"تسويق رقمي\",\"default_account\":\"5207 - مصروفات التسويق الرقمي - GRC\",\"description\":\"<div class=\\\"ql-editor read-mode\\\"><p>digital marketing</p></div>\",\"amount\":125,\"sanctioned_amount\":125,\"cost_center\":\"رئيسي - GRC\",\"parent\":\"HR-EXP-2025-00001\",\"parentfield\":\"expenses\",\"parenttype\":\"Expense Claim\",\"doctype\":\"Expense Claim Detail\"}],\"__onload\":{\"make_payment_via_journal_entry\":0,\"self_expense_approval_not_allowed\":0},\"__last_sync_on\":\"2025-10-16T07:14:35.383Z\"}",
		"action": "Submit"
	},
	"btn": {
		"jQuery370086928261783395141": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 967,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

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

Im still facing the problem, thus i have reported the issue on github Error when submitting ‘expense claim’ Server Error AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’ Possible source of error: hrms (app) · Issue #50183 · frappe/erpnext · GitHub