fixes in Purchase Invoice

This commit is contained in:
Neil Trini Lasrado
2015-04-30 13:05:36 +05:30
parent 01720404db
commit 42a554e5cb
4 changed files with 13 additions and 17 deletions

View File

@@ -91,8 +91,8 @@ 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(grand_total) as cost
from `tabPurchase Invoice` where project = %s and docstatus=1 """, self.name, as_dict=1)[0].cost or 0
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
@frappe.whitelist()
def get_cost_center_name(project_name):