[Fix] Total materials consumed cost not consider in the calculation of Gross Margin in project (#15171)

This commit is contained in:
rohitwaghchaure
2018-08-20 17:39:54 +05:30
committed by Nabin Hait
parent 5c5688b374
commit ecc6af9d2a
4 changed files with 24 additions and 4 deletions

View File

@@ -82,6 +82,7 @@ class StockEntry(StockController):
if self.purchase_order and self.purpose == "Subcontract":
self.update_purchase_order_supplied_items()
self.make_gl_entries_on_cancel()
self.update_cost_in_project()
def validate_purpose(self):
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture",
@@ -107,8 +108,8 @@ class StockEntry(StockController):
se.docstatus = 1 and se.project = %s and sed.parent = se.name
and (sed.t_warehouse is null or sed.t_warehouse = '')""", self.project, as_list=1)
if amount:
frappe.db.set_value('Project', self.project, 'total_consumed_material_cost', amount[0][0])
amount = amount[0][0] if amount else 0
frappe.db.set_value('Project', self.project, 'total_consumed_material_cost', amount)
def validate_item(self):
stock_items = self.get_stock_items()