From 197cd88d36816e95da185956f2aecab1cf0639bf Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Thu, 26 Jul 2018 21:11:07 +0530 Subject: [PATCH] Lab Test Template - rate updation - fix --- .../doctype/lab_test_template/lab_test_template.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py index d76fb29adc..62a3b306c8 100644 --- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py +++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py @@ -12,13 +12,16 @@ class LabTestTemplate(Document): #Item and Price List update --> if (change_in_item) if(self.change_in_item and self.is_billable == 1 and self.item): updating_item(self) - if not item_price_exist(self): + item_price = item_price_exist(self) + if not item_price: if(self.test_rate != 0.0): price_list_name = frappe.db.get_value("Price List", {"selling": 1}) if(self.test_rate): make_item_price(self.test_code, price_list_name, self.test_rate) else: make_item_price(self.test_code, price_list_name, 0.0) + else: + frappe.db.set_value("Item Price", item_price, "price_list_rate", self.test_rate) frappe.db.set_value(self.doctype,self.name,"change_in_item",0) elif(self.is_billable == 0 and self.item): @@ -43,7 +46,7 @@ def item_price_exist(doc): "doctype": "Item Price", "item_code": doc.test_code}) if(item_price): - return True + return item_price[0][0] else: return False