From c33ad6b36a21abed90b463039f74c4bdf2465156 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 8 Apr 2015 17:42:38 +0530 Subject: [PATCH] fixes in Activity Cost --- erpnext/projects/doctype/activity_cost/activity_cost.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.py b/erpnext/projects/doctype/activity_cost/activity_cost.py index 03aff28a29..fb2d6666b9 100644 --- a/erpnext/projects/doctype/activity_cost/activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/activity_cost.py @@ -16,6 +16,7 @@ class ActivityCost(Document): self.title = _("{0} for {1}").format(self.employee_name, self.activity_type) def check_unique(self): - if frappe.db.exists({ "doctype": "Activity Cost", "employee": self.employee, "activity_type": self.activity_type }): - frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type {1}") - .format(self.employee, self.activity_type)) + if frappe.db.sql("""select name from `tabActivity Cost` where employee_name= %s and activity_type= %s and name != %s""", + (self.employee_name, self.activity_type, self.name)): + frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}") + .format(self.employee, self.activity_type))