[cleanup] [stock entry] [sales order]

This commit is contained in:
Rushabh Mehta
2013-07-03 18:32:29 +05:30
parent 9a04b19160
commit bcff7dce8e
13 changed files with 299 additions and 236 deletions

View File

@@ -20,20 +20,19 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
}
cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.dashboard.reset();
erpnext.hide_naming_series();
cur_frm.set_intro("");
cfn_set_fields(doc, dt, dn);
if(doc.docstatus===0 && !doc.__islocal) {
cur_frm.set_intro("Submit this Production Order for further processing.");
} else if(doc.docstatus===1) {
var percent = flt(doc.produced_qty) / doc.qty * 100;
cur_frm.dashboard.add_progress(cint(percent) + "% " + wn._("Complete"));
if(doc.status === "Stopped") {
cur_frm.set_intro("This Production Order is Stopped.");
} else {
if(doc.produced_qty == doc.qty) {
cur_frm.set_intro("This Production Order is Completed.");
} else {
cur_frm.set_intro("This Production Order is in progress.");
}
cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");
}
}
}
@@ -88,6 +87,12 @@ 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;

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:16",
"docstatus": 0,
"modified": "2013-07-02 11:56:54",
"modified": "2013-07-03 17:00:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -42,6 +42,13 @@
"doctype": "DocType",
"name": "Production Order"
},
{
"doctype": "DocField",
"fieldname": "item",
"fieldtype": "Section Break",
"label": "Item",
"options": "icon-gift"
},
{
"default": "PRO",
"doctype": "DocField",
@@ -51,22 +58,6 @@
"options": "\nPRO",
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "status",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"read_only": 1,
"reqd": 1,
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "production_item",
@@ -95,24 +86,12 @@
"reqd": 1
},
{
"depends_on": "production_item",
"description": "Manufactured quantity will be updated in this warehouse",
"default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"doctype": "DocField",
"fieldname": "fg_warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "For Warehouse",
"options": "Warehouse",
"read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"reqd": 1
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM"
},
{
"doctype": "DocField",
@@ -122,6 +101,15 @@
"read_only": 0,
"width": "50%"
},
{
"description": "Manufacture against Sales Order",
"doctype": "DocField",
"fieldname": "sales_order",
"fieldtype": "Link",
"label": "Sales Order",
"options": "Sales Order",
"read_only": 0
},
{
"depends_on": "production_item",
"doctype": "DocField",
@@ -147,38 +135,60 @@
"read_only": 1
},
{
"depends_on": "production_item",
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"label": "Stock UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
"read_only": 1
"fieldname": "warehouses",
"fieldtype": "Section Break",
"label": "Warehouses",
"options": "icon-building"
},
{
"default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"depends_on": "production_item",
"description": "Manufactured quantity will be updated in this warehouse",
"doctype": "DocField",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM"
"fieldname": "fg_warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "For Warehouse",
"options": "Warehouse",
"read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"options": "icon-file-text",
"read_only": 0
},
{
"description": "Manufacture against Sales Order",
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "sales_order",
"fieldtype": "Link",
"label": "Sales Order",
"options": "Sales Order",
"read_only": 0
"fieldname": "status",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"read_only": 1,
"reqd": 1,
"search_index": 1
},
{
"doctype": "DocField",
@@ -205,6 +215,16 @@
"read_only": 0,
"width": "50%"
},
{
"depends_on": "production_item",
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"label": "Stock UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "company",