Trying to tax an item a new sales invoice

	"erpnext": "13.21.0",
	"frappe": "13.21.0",


Form/Sales Invoice/2022-00026


Traceback (most recent call last):
  File "apps/frappe/frappe/", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/", line 68, in execute_cmd
    return, **frappe.form_dict)
  File "apps/frappe/frappe/", line 1213, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/", line 54, in search_link
    search_widget(doctype, txt.strip(), query, searchfield=searchfield, page_length=page_length, filters=filters, reference_doctype=reference_doctype, ignore_user_permissions=ignore_user_permissions)
  File "apps/frappe/frappe/desk/", line 90, in search_widget
    raise e
  File "apps/frappe/frappe/desk/", line 80, in search_widget
    frappe.response["values"] =, doctype, txt,
  File "apps/frappe/frappe/", line 1213, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/", line 241, in validate_and_sanitize_search_inputs
    return fn(**kwargs)
  File "apps/erpnext/erpnext/controllers/", line 752, in get_tax_template
    return frappe.get_all('Item Tax Template', filters={'disabled': 0, 'company': company}, as_list=True)
  File "apps/frappe/frappe/", line 1474, in get_all
    return get_list(doctype, *args, **kwargs)
  File "apps/frappe/frappe/", line 1447, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
  File "apps/frappe/frappe/model/", line 107, in execute
    result = self.build_and_run()
  File "apps/frappe/frappe/model/", line 144, in build_and_run
    return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug,
  File "apps/frappe/frappe/database/", line 152, in sql
  File "env/lib/python3.8/site-packages/pymysql/", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.8/site-packages/pymysql/", line 310, in _query
  File "env/lib/python3.8/site-packages/pymysql/", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.8/site-packages/pymysql/", line 775, in _read_query_result
  File "env/lib/python3.8/site-packages/pymysql/", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.8/site-packages/pymysql/", line 725, in _read_packet
  File "env/lib/python3.8/site-packages/pymysql/", line 221, in raise_for_error
  File "env/lib/python3.8/site-packages/pymysql/", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'tabItem Tax Template.disabled' in 'where clause'")

Request Data

	"type": "POST",
	"args": {
		"txt": "",
		"doctype": "Item Tax Template",
		"ignore_user_permissions": 0,
		"reference_doctype": "Sales Invoice Item",
		"query": "erpnext.controllers.queries.get_tax_template",
		"filters": "{\"item_code\":\"SERVKEYRESEARCH\",\"valid_from\":[\"<=\",\"2022-03-10\"],\"item_group\":\"SERVICIO\",\"company\":\"MyCompany\"}"
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/"

Response Data

	"exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'tabItem Tax Template.disabled' in 'where clause'\")"


Please check and ensure the the ‘Item Tax Template’ doc type already have the field 'Disabled"

If it is not there, your try to fix it by “bench update --patch” or simply create this field by using “Custom Field”

1 Like

Thanks for your reply but I just executed bench --site my-site migrate and the issue disappears.

1 Like