Merge pull request #19746 from rohitwaghchaure/fixed_customer_selection_issue_in_sales_invoice_healthcare_module
fix: please specify customer error in sales invoice if patient is blank
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 3c85210..2ea74f6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -789,22 +789,21 @@
method: "frappe.client.get_value",
args:{
doctype: "Patient",
- filters: {"name": frm.doc.patient},
+ filters: {
+ "name": frm.doc.patient
+ },
fieldname: "customer"
},
- callback:function(patient_customer) {
- if(patient_customer){
- frm.set_value("customer", patient_customer.message.customer);
- frm.refresh_fields();
+ callback:function(r) {
+ if(r && r.message.customer){
+ frm.set_value("customer", r.message.customer);
}
}
});
}
- else{
- frm.set_value("customer", '');
- }
}
},
+
refresh: function(frm) {
if (frappe.boot.active_domains.includes("Healthcare")){
frm.set_df_property("patient", "hidden", 0);