feat: added checkbox 'Update Consumed Material Cost In Project' in work order to don't update the consumed material cost in the project for the subassembely work orders (#18533)
This commit is contained in:
parent
08df6bda41
commit
9601b6c601
@ -320,7 +320,8 @@ class ProductionPlan(Document):
|
|||||||
'qty': data.get("stock_qty") * item.get("qty"),
|
'qty': data.get("stock_qty") * item.get("qty"),
|
||||||
'production_plan': self.name,
|
'production_plan': self.name,
|
||||||
'company': self.company,
|
'company': self.company,
|
||||||
'fg_warehouse': item.get("fg_warehouse")
|
'fg_warehouse': item.get("fg_warehouse"),
|
||||||
|
'update_consumed_material_cost_in_project': 0
|
||||||
})
|
})
|
||||||
|
|
||||||
work_order = self.create_work_order(data)
|
work_order = self.create_work_order(data)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"creation": "2013-01-10 16:34:16",
|
"creation": "2013-01-10 16:34:16",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Setup",
|
"document_type": "Setup",
|
||||||
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"item",
|
"item",
|
||||||
"naming_series",
|
"naming_series",
|
||||||
@ -12,9 +13,6 @@
|
|||||||
"item_name",
|
"item_name",
|
||||||
"image",
|
"image",
|
||||||
"bom_no",
|
"bom_no",
|
||||||
"allow_alternative_item",
|
|
||||||
"use_multi_level_bom",
|
|
||||||
"skip_transfer",
|
|
||||||
"column_break1",
|
"column_break1",
|
||||||
"company",
|
"company",
|
||||||
"qty",
|
"qty",
|
||||||
@ -22,7 +20,13 @@
|
|||||||
"produced_qty",
|
"produced_qty",
|
||||||
"sales_order",
|
"sales_order",
|
||||||
"project",
|
"project",
|
||||||
|
"settings_section",
|
||||||
|
"allow_alternative_item",
|
||||||
|
"use_multi_level_bom",
|
||||||
|
"column_break_18",
|
||||||
|
"skip_transfer",
|
||||||
"from_wip_warehouse",
|
"from_wip_warehouse",
|
||||||
|
"update_consumed_material_cost_in_project",
|
||||||
"warehouses",
|
"warehouses",
|
||||||
"wip_warehouse",
|
"wip_warehouse",
|
||||||
"fg_warehouse",
|
"fg_warehouse",
|
||||||
@ -442,13 +446,28 @@
|
|||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"options": "Work Order",
|
"options": "Work Order",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "settings_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Settings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_18",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "1",
|
||||||
|
"fieldname": "update_consumed_material_cost_in_project",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Update Consumed Material Cost In Project"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-cogs",
|
"icon": "fa fa-cogs",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-05-27 09:36:16.707719",
|
"modified": "2019-07-31 00:13:38.218277",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Work Order",
|
"name": "Work Order",
|
||||||
@ -477,8 +496,9 @@
|
|||||||
"role": "Stock User"
|
"role": "Stock User"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"sort_field": "modified",
|
||||||
"sort_order": "ASC",
|
"sort_order": "ASC",
|
||||||
"title_field": "production_item",
|
"title_field": "production_item",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 1
|
"track_seen": 1
|
||||||
}
|
}
|
@ -145,6 +145,10 @@ class StockEntry(StockController):
|
|||||||
self.precision("transfer_qty", item))
|
self.precision("transfer_qty", item))
|
||||||
|
|
||||||
def update_cost_in_project(self):
|
def update_cost_in_project(self):
|
||||||
|
if (self.work_order and not frappe.db.get_value("Work Order",
|
||||||
|
self.work_order, "update_consumed_material_cost_in_project")):
|
||||||
|
return
|
||||||
|
|
||||||
if self.project:
|
if self.project:
|
||||||
amount = frappe.db.sql(""" select ifnull(sum(sed.amount), 0)
|
amount = frappe.db.sql(""" select ifnull(sum(sed.amount), 0)
|
||||||
from
|
from
|
||||||
|
Loading…
x
Reference in New Issue
Block a user