Fixes in Activity Cost
This commit is contained in:
parent
ae4cc078ea
commit
64cacfb077
@ -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)
|
||||
|
@ -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 {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user