Added consumed material cost in project (#13365)
This commit is contained in:
parent
80a9f523d5
commit
492de67d7b
@ -1119,6 +1119,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_consumed_material_cost",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Total Consumed Material Cost (via Stock Entry)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@ -1285,7 +1315,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 4,
|
||||
"modified": "2017-12-10 08:40:46.843201",
|
||||
"modified": "2018-03-22 11:44:38.723507",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Project",
|
||||
|
@ -74,6 +74,7 @@ class StockEntry(StockController):
|
||||
if self.purchase_order and self.purpose == "Subcontract":
|
||||
self.update_purchase_order_supplied_items()
|
||||
self.make_gl_entries()
|
||||
self.update_cost_in_project()
|
||||
|
||||
def on_cancel(self):
|
||||
self.update_stock_ledger()
|
||||
@ -97,6 +98,18 @@ class StockEntry(StockController):
|
||||
item.transfer_qty = flt(flt(item.qty) * flt(item.conversion_factor),
|
||||
self.precision("transfer_qty", item))
|
||||
|
||||
def update_cost_in_project(self):
|
||||
if self.project:
|
||||
amount = frappe.db.sql(""" select ifnull(sum(sed.amount), 0)
|
||||
from
|
||||
`tabStock Entry` se, `tabStock Entry Detail` sed
|
||||
where
|
||||
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])
|
||||
|
||||
def validate_item(self):
|
||||
stock_items = self.get_stock_items()
|
||||
serialized_items = self.get_serialized_items()
|
||||
|
Loading…
x
Reference in New Issue
Block a user