diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index b8ea205d48..a4588b3dd8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -939,7 +939,9 @@ var set_primary_action= function(frm, dialog, $results, invoice_healthcare_servi dialog.set_primary_action(__('Add'), function() { let checked_values = get_checked_values($results); if(checked_values.length > 0){ - frm.set_value("patient", dialog.fields_dict.patient.input.value); + if(invoice_healthcare_services) { + frm.set_value("patient", dialog.fields_dict.patient.input.value); + } frm.set_value("items", []); add_to_item_line(frm, checked_values, invoice_healthcare_services); dialog.hide();