[manufacturing] Added New Reports

This commit is contained in:
Rushabh Mehta
2013-08-12 14:18:09 +05:30
parent cf2cf3897b
commit 4c17f9420e
14 changed files with 219 additions and 70 deletions

View File

@@ -61,30 +61,25 @@ cur_frm.cscript['Unstop Production Order'] = function() {
}
cur_frm.cscript['Transfer Raw Materials'] = function() {
var doc = cur_frm.doc;
cur_frm.cscript.make_se(doc, 'Material Transfer');
cur_frm.cscript.make_se('Material Transfer');
}
cur_frm.cscript['Update Finished Goods'] = function() {
var doc = cur_frm.doc;
cur_frm.cscript.make_se(doc, 'Manufacture/Repack');
cur_frm.cscript.make_se('Manufacture/Repack');
}
cur_frm.cscript.make_se = function(doc, purpose) {
var se = wn.model.get_new_doc("Stock Entry");
se.purpose = purpose;
se.production_order = doc.name;
if(purpose==="Material Transfer") {
se.to_warehouse = doc.wip_warehouse;
} else {
se.from_warehouse = doc.wip_warehouse;
se.to_warehouse = doc.fg_warehouse;
}
se.company = doc.company;
se.fg_completed_qty = doc.qty - doc.produced_qty;
se.bom_no = doc.bom_no;
se.use_multi_level_bom = doc.use_multi_level_bom;
loaddoc('Stock Entry', se.name);
cur_frm.cscript.make_se = function(purpose) {
wn.call({
method:"manufacturing.doctype.production_order.production_order.make_stock_entry",
args: {
"production_order_id": cur_frm.doc.name,
"purpose": purpose
},
callback: function(r) {
var doclist = wn.model.sync(r.message);
wn.set_route("Form", doclist[0].doctype, doclist[0].name);
}
})
}
cur_frm.fields_dict['production_item'].get_query = function(doc) {

View File

@@ -137,4 +137,23 @@ def get_item_details(item):
if bom:
res.bom_no = bom[0][0]
return res
return res
@webnotes.whitelist()
def make_stock_entry(production_order_id, purpose):
production_order = webnotes.bean("Production Order", production_order_id)
stock_entry = webnotes.new_bean("Stock Entry")
stock_entry.doc.purpose = purpose
stock_entry.doc.production_order = production_order_id
stock_entry.doc.company = production_order.doc.company
stock_entry.doc.bom_no = production_order.doc.bom_no
stock_entry.doc.fg_completed_qty = flt(production_order.doc.qty) - flt(production_order.doc.produced_qty)
if purpose=="Material Transfer":
stock_entry.doc.to_warehouse = production_order.doc.wip_warehouse
else:
stock_entry.doc.from_warehouse = production_order.doc.wip_warehouse
stock_entry.doc.to_warehouse = production_order.doc.fg_warehouse
return [d.fields for d in stock_entry.doclist]

View File

@@ -64,11 +64,26 @@ wn.module_page["Manufacturing"] = [
right: true,
icon: "icon-list",
items: [
{
"label":wn._("Open Production Orders"),
route: "query-report/Open Production Orders",
doctype:"Production Order"
},
{
"label":wn._("Production Orders in Progress"),
route: "query-report/Production Orders in Progress",
doctype:"Production Order"
},
{
"label":wn._("Issued Items Against Production Order"),
route: "query-report/Issued Items Against Production Order",
doctype:"Production Order"
},
{
"label":wn._("Completed Production Orders"),
route: "query-report/Completed Production Orders",
doctype:"Production Order"
},
]
}
]

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-08-12 12:44:27",
"docstatus": 0,
"modified": "2013-08-12 12:44:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) = `tabProduction Order`.qty",
"ref_doctype": "Production Order",
"report_name": "Completed Production Orders",
"report_type": "Query Report"
},
{
"doctype": "Report",
"name": "Completed Production Orders"
}
]

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-08-12 12:32:30",
"docstatus": 0,
"modified": "2013-08-12 12:42:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
"ref_doctype": "Production Order",
"report_name": "Open Production Orders",
"report_type": "Query Report"
},
{
"doctype": "Report",
"name": "Open Production Orders"
}
]

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-08-12 12:43:47",
"docstatus": 0,
"modified": "2013-08-12 12:43:47",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
"ref_doctype": "Production Order",
"report_name": "Production Orders in Progress",
"report_type": "Query Report"
},
{
"doctype": "Report",
"name": "Production Orders in Progress"
}
]