Added Feature - Update FG based on Material Transfer For Manufacturing
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
index eb770a8..dff04a4 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
@@ -42,6 +42,15 @@
"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",
"permlevel": 0,
@@ -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",
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index 9a1a05a..2ce7a1f 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -25,6 +25,12 @@
"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) {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 01129bf..a9b9505 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -551,6 +551,12 @@
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 @@
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 @@
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):
"""