Try ERPNext Buy Support Partners Foundation

NameError: name 'patient' is not defined

Hi.

Fresh installation of:
ERRPNext: v12.8.0 (version-12)
Frappe Framework: v12.5.2 (version-12)

In Healthcare Module, after trying to create the first appointment I get:

NameError: name ‘patient’ is not defined

Any suggestion?

Hello, I am not able to replicate this. Can you please post the entire traceback? Also, the Healthcare Module has been refactored in version 13. You can migrate to v13 for a better experience!

Hi. Dear Ms Rucha_Mabal.

Please see entire traceback.

In advance thanks for your help!!!.

Definitivel››y I’m going to try version 13. Just I can’t find the right steps to install. Any suggestion?

Best Regards.

[DEBUG] 2020-05-21 11:48:51,128 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:49:51,280 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:50:51,434 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:51:51,582 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:52:51,761 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[ERROR] 2020-05-21 11:53:51,315 | /home/frappe/frappe-bench/apps/frappe/frappe/app.py:
Site: site1.local
Form Dict: {
“cmd”: “frappe.desk.form.save.savedocs”
}
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
TypeError: savedocs() missing 2 required positional arguments: ‘doc’ and ‘action’
[ERROR] 2020-05-21 11:53:51,475 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py:
Could not take error snapshot: invalid syntax (, line 1)
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
TypeError: savedocs() missing 2 required positional arguments: ‘doc’ and ‘action’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py”, line 36, in make_error_snapshot
snapshot = get_snapshot(exception)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py”, line 132, in get_snapshot
value = eval(value)
File “”, line 1

^
SyntaxError: invalid syntax
[DEBUG] 2020-05-21 11:53:51,912 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:54:52,068 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:55:52,165 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:56:52,299 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:57:52,449 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:58:52,601 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 11:59:52,756 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:00:52,959 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:01:53,109 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:02:53,264 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[ERROR] 2020-05-21 12:03:43,297 | /home/frappe/frappe-bench/apps/frappe/frappe/app.py:
Site: site1.local
Form Dict: {
“action”: “Save”,
“cmd”: “frappe.desk.form.save.savedocs”,
“doc”: “{“docstatus”:0,“doctype”:“Patient Appointment”,“name”:“Nuevo Cita del Paciente 2","__islocal":1,"__unsaved":1,“owner”:"setsero02@gmail.com”,“status”:“Open”,“appointment_time”:“10:30:00”,“invoiced”:0,“company”:“Cl\u00ednica Maxima”,“reminded”:0,“inpatient_record”:null,“patient_name”:“Orestes Martinez”,“patient_sex”:“Male”,“patient”:“HLC-PAT-2020-00002”,“patient_age”:“48 Year(s) 5 Month(s) 17 Day(s)”,“appointment_type”:“Consulta inicial”,“duration”:“15”,“procedure_template”:“Consulta de nutrici\u00f3n”,“service_unit”:”",“practitioner”:“Maxima Rodriguez”,“department”:“Nutrici\u00f3n”,“appointment_date”:“2020-05-22”,“paid_amount”:0}"
}
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 273, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 296, in _save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 254, in insert
self.run_method(“after_insert”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 794, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1064, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1047, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 788, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 72, in after_insert
confirm_sms(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 309, in confirm_sms
send_message(doc, message)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 355, in send_message
number = [patient.mobile]
NameError: name ‘patient’ is not defined :thinking:
[ERROR] 2020-05-21 12:03:43,304 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py:
Could not take error snapshot: invalid syntax (, line 1)
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 56, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 273, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 296, in _save
self.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 254, in insert
self.run_method(“after_insert”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 794, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1064, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1047, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 788, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 72, in after_insert
confirm_sms(self)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 309, in confirm_sms
send_message(doc, message)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py”, line 355, in send_message
number = [patient.mobile]
NameError: name ‘patient’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py”, line 36, in make_error_snapshot
snapshot = get_snapshot(exception)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py”, line 132, in get_snapshot
value = eval(value)
File “”, line 1

^
SyntaxError: invalid syntax
[DEBUG] 2020-05-21 12:03:53,425 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:04:53,559 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:05:53,709 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:06:53,862 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:07:54,011 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:08:54,214 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:09:54,320 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:10:54,423 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:11:54,573 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:12:54,694 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:13:54,852 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:14:55,001 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:15:55,152 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:16:55,327 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:17:55,474 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:18:55,585 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:19:55,736 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:20:55,858 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:21:56,006 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:22:56,155 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:23:56,303 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:24:56,476 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:25:56,631 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:26:56,781 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:27:56,931 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local
[DEBUG] 2020-05-21 12:28:57,116 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Queued events for site site1.local

This issue was reported earlier and has been fixed, please update.

hope this helps, thanks

1 Like