From 64cacfb07783f70492d9d0fa2140cc89660ae8dc Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 16 Jun 2015 15:42:40 +0530 Subject: [PATCH] Fixes in Activity Cost --- erpnext/projects/doctype/activity_cost/activity_cost.py | 2 +- erpnext/projects/doctype/time_log/time_log.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.py b/erpnext/projects/doctype/activity_cost/activity_cost.py index f2c50991ac..862a70717a 100644 --- a/erpnext/projects/doctype/activity_cost/activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/activity_cost.py @@ -29,7 +29,7 @@ class ActivityCost(Document): frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}") .format(self.employee, self.activity_type), DuplicationError) else: - if frappe.db.sql("""select name from `tabActivity Cost` where employee_name IS NULL and activity_type= %s and name != %s""", + if frappe.db.sql("""select name from `tabActivity Cost` where ifnull(employee, '')='' and activity_type= %s and name != %s""", (self.activity_type, self.name)): frappe.throw(_("Default Activity Cost exists for Activity Type - {0}") .format(self.activity_type), DuplicationError) diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py index e863561cb8..841ef28e16 100644 --- a/erpnext/projects/doctype/time_log/time_log.py +++ b/erpnext/projects/doctype/time_log/time_log.py @@ -273,6 +273,6 @@ def get_activity_cost(employee=None, activity_type=None): rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where employee= %s and activity_type= %s""", (employee, activity_type), as_dict=1) if not rate: - rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where employee IS NULL + rate = frappe.db.sql("""select costing_rate, billing_rate from `tabActivity Cost` where ifnull(employee, '')='' and activity_type= %s""", (activity_type), as_dict=1) return rate[0] if rate else {}