Added Feature - Update FG based on Material Transfer For Manufacturing
This commit is contained in:
parent
6f593130d0
commit
845980c010
@ -41,6 +41,15 @@
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"default": "BOM",
|
||||
"fieldname": "update_fg_based_on",
|
||||
"fieldtype": "Select",
|
||||
"label": "Update FG Based On",
|
||||
"options": "BOM\nMaterial Transfer for Manufacture",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
@ -79,7 +88,7 @@
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-23 08:12:33.889753",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
|
@ -25,6 +25,12 @@ erpnext.financial_statements = {
|
||||
"options": "Yearly\nHalf-yearly\nQuarterly\nMonthly",
|
||||
"default": "Yearly",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "accumulated_value",
|
||||
"label": __("Accumulated Value"),
|
||||
"fieldtype": "Check",
|
||||
"depends_on": "eval:accumulated_value= 'Yearly'"
|
||||
}
|
||||
],
|
||||
"formatter": function(row, cell, value, columnDef, dataContext, default_formatter) {
|
||||
|
@ -551,6 +551,12 @@ class StockEntry(StockController):
|
||||
if self.to_warehouse and self.pro_doc:
|
||||
for item in item_dict.values():
|
||||
item["to_warehouse"] = self.pro_doc.wip_warehouse
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
|
||||
elif self.production_order and self.purpose == "Manufacture" and \
|
||||
frappe.db.get_single_value("Manufacturing Settings", "update_fg_based_on")== "Material Transfer for Manufacture":
|
||||
self.get_transfered_raw_materials()
|
||||
|
||||
else:
|
||||
if not self.fg_completed_qty:
|
||||
frappe.throw(_("Manufacturing Quantity is mandatory"))
|
||||
@ -561,9 +567,7 @@ class StockEntry(StockController):
|
||||
item["from_warehouse"] = self.pro_doc.wip_warehouse
|
||||
|
||||
item["to_warehouse"] = self.to_warehouse if self.purpose=="Subcontract" else ""
|
||||
|
||||
# add raw materials to Stock Entry Detail table
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
|
||||
# add finished goods item
|
||||
if self.purpose in ("Manufacture", "Repack"):
|
||||
@ -604,8 +608,27 @@ class StockEntry(StockController):
|
||||
|
||||
for item in item_dict.values():
|
||||
item.from_warehouse = self.from_warehouse or item.default_warehouse
|
||||
|
||||
return item_dict
|
||||
|
||||
def get_transfered_raw_materials(self):
|
||||
items_dict = frappe.db.sql("""select item_name, item_code, sum(qty) as qty, to_warehouse, from_warehouse,
|
||||
description, stock_uom, expense_account, cost_center from `tabStock Entry` se,`tabStock Entry Detail` sed
|
||||
where se.name = sed.parent and se.docstatus=1 and se.purpose='Material Transfer for Manufacture' and
|
||||
se.production_order= %s and se.to_warehouse= %s group by sed.item_code;""",
|
||||
(self.production_order, self.from_warehouse), as_dict=1)
|
||||
for item in items_dict:
|
||||
self.add_to_stock_entry_detail({
|
||||
item.item_code: {
|
||||
"to_warehouse": item.to_warehouse,
|
||||
"from_warehouse": item.from_warehouse,
|
||||
"qty": item.qty,
|
||||
"item_name": item.item_name,
|
||||
"description": item.description,
|
||||
"stock_uom": item.stock_uom,
|
||||
"expense_account": item.expense_account,
|
||||
"cost_center": item.buying_cost_center,
|
||||
}
|
||||
})
|
||||
|
||||
def get_pending_raw_materials(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user