mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 06:28:29 +00:00
[fix] Purchase cost against project
This commit is contained in:
@@ -107,8 +107,10 @@ class Project(Document):
|
||||
self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100
|
||||
|
||||
def update_purchase_costing(self):
|
||||
self.total_purchase_cost = frappe.db.sql("""select sum(amount) as cost
|
||||
from `tabPurchase Invoice Item` where project_name = %s and docstatus=1 """, self.name, as_dict=1)[0].cost or 0
|
||||
total_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
|
||||
from `tabPurchase Invoice Item` where project_name = %s and docstatus=1 """, self.name)
|
||||
|
||||
self.total_purchase_cost = total_purchase_cost[0][0] if total_purchase_cost else 0
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_cost_center_name(project_name):
|
||||
|
||||
Reference in New Issue
Block a user