mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
Fixes in Activity Cost
This commit is contained in:
@@ -29,7 +29,7 @@ class ActivityCost(Document):
|
|||||||
frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}")
|
frappe.throw(_("Activity Cost exists for Employee {0} against Activity Type - {1}")
|
||||||
.format(self.employee, self.activity_type), DuplicationError)
|
.format(self.employee, self.activity_type), DuplicationError)
|
||||||
else:
|
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)):
|
(self.activity_type, self.name)):
|
||||||
frappe.throw(_("Default Activity Cost exists for Activity Type - {0}")
|
frappe.throw(_("Default Activity Cost exists for Activity Type - {0}")
|
||||||
.format(self.activity_type), DuplicationError)
|
.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
|
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)
|
and activity_type= %s""", (employee, activity_type), as_dict=1)
|
||||||
if not rate:
|
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)
|
and activity_type= %s""", (activity_type), as_dict=1)
|
||||||
return rate[0] if rate else {}
|
return rate[0] if rate else {}
|
||||||
|
|||||||
Reference in New Issue
Block a user