From bd4348db107ea7dc5a17f465fc722575951805d2 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 7 Sep 2018 16:16:23 +0530 Subject: [PATCH] [Enhance] Add additional cost of the manufacture stock entry in the project costing (#15341) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4905446c917..4cd15efaa24 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -109,6 +109,16 @@ class StockEntry(StockController): and (sed.t_warehouse is null or sed.t_warehouse = '')""", self.project, as_list=1) amount = amount[0][0] if amount else 0 + additional_costs = frappe.db.sql(""" select ifnull(sum(sed.amount), 0) + from + `tabStock Entry` se, `tabLanded Cost Taxes and Charges` sed + where + se.docstatus = 1 and se.project = %s and sed.parent = se.name + and se.purpose = 'Manufacture'""", self.project, as_list=1) + + additional_cost_amt = additional_costs[0][0] if additional_costs else 0 + + amount += additional_cost_amt frappe.db.set_value('Project', self.project, 'total_consumed_material_cost', amount) def validate_item(self):