Try ERPNext Buy Support Partners Foundation

I'm getting this error while creating a sales invoice for patients manually, AttributeError: 'SalesInvoice' object has no attribute 'patient'

AttributeError: ‘SalesInvoice’ object has no attribute ‘patient’

Error report:

Form/Sales Invoice/ACC-SINV-2020-00001
Error Report
Traceback (most recent call last):
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/init.py”, line 527, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 248, in get_open_count
total = len(frappe.get_all(d, fields=“name”,
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/init.py”, line 1318, in get_all
return get_list(doctype, *args, **kwargs)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/init.py”, line 1291, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 96, in execute
result = self.build_and_run()
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 130, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
File “/home/clear_sky/frappe-bench/apps/frappe/frappe/database/database.py”, line 171, in sql
self._cursor.execute(query)
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/clear_sky/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, “Unknown column ‘tabSales Invoice.patient’ in ‘where clause’”)

Please suggest me a solution for this,

Since i was not able to create invoices automatically i tried creating invoice manually since erpnext patient creation also creates appropriate customer but getting this also i wasn’t able get the items from health services by using get the items from button in sales invoice creation.

NOTE: I got the same pymysql.err.InternalError: (1054, “Unknown column ‘tabSales Invoice.patient’ in ‘where clause’”) when in created patients, Patients got created but got this error on every patient creation i have posted that error(Getting This error while creating patients. pymysql.err.InternalError: (1054, "Unknown column 'tabSales Invoice.patient' in 'where clause'")) to but didn’t get any reply so Hope that anyone replies to , Pls any suggestions will be helpful.

Looks like the domain was not setup properly, the custom field Patient in Sales Invoice is not created. Could you please check if Healthcare domain is active?

Healthcare domain is active and i have created patient field in sales Invoice through customize form. i was able to make the payments also. But i was doing it manually since Sales Invoice was not created on patient encounter. I have checked in Healthcare Settings, Invoice Appointments Automatically is checked. But it is not creating any invoice on patient encounter.