minor fixes
This commit is contained in:
parent
41781ce686
commit
1fa7171bfa
@ -31,7 +31,7 @@ cur_frm.cscript.with_operations = function(doc) {
|
||||
}
|
||||
|
||||
erpnext.bom.set_operation = function(doc) {
|
||||
var op_table = doc.bom_operations || [];
|
||||
var op_table = doc["bom_operations"] || [];
|
||||
var operations = [];
|
||||
|
||||
for (var i=0, j=op_table.length; i<j; i++) {
|
||||
@ -51,9 +51,6 @@ cur_frm.cscript.bom_operations_remove = function(){
|
||||
cur_frm.add_fetch("item", "description", "description");
|
||||
cur_frm.add_fetch("item", "stock_uom", "uom");
|
||||
|
||||
cur_frm.cscript.workstation = function(doc,dt,dn) {
|
||||
get_workstation_detail(doc,dt,dn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.hour_rate = function(doc, dt, dn) {
|
||||
erpnext.bom.calculate_op_cost(doc);
|
||||
@ -153,9 +150,8 @@ erpnext.bom.calculate_rm_cost = function(doc) {
|
||||
// Calculate Total Cost
|
||||
erpnext.bom.calculate_total = function(doc) {
|
||||
doc.total_variable_cost = flt(doc.raw_material_cost) + flt(doc.operating_cost) ;
|
||||
refresh_field('total_variable_cost');
|
||||
doc.total_cost = flt(doc.total_fixed_cost) + flt(doc.total_variable_cost);
|
||||
refresh_field('total_cost');
|
||||
refresh_field(['total_variable_cost', 'total_cost']);
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +171,10 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return{
|
||||
query: "erpnext.controllers.queries.item_query"
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters: {
|
||||
"name": "!" + cstr(doc.item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,29 +196,38 @@ cur_frm.cscript.validate = function(doc, dt, dn) {
|
||||
erpnext.bom.calculate_total(doc);
|
||||
}
|
||||
|
||||
cur_frm.cscript.operation = function(doc,dt,dn) {
|
||||
var d = locals[dt][dn];
|
||||
frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
|
||||
if(d.parentfield=="bom_operations") {
|
||||
erpnext.bom.set_operation(doc);
|
||||
frappe.model.with_doc("Operation", d.operation, function(name, r) {
|
||||
d.opn_description = r.docs[0].opn_description;
|
||||
d.workstation = r.docs[0].workstation;
|
||||
refresh_field("bom_operations");
|
||||
get_workstation_detail(doc,dt,dn);
|
||||
});
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Operation",
|
||||
name: d.operation
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(d.doctype, d.name, "opn_description", data.message.opn_description);
|
||||
frappe.model.set_value(d.doctype, d.name, "workstation", data.message.workstation);
|
||||
erpnext.bom.set_operation(frm.doc);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
var get_workstation_detail = function(doc, dt, dn) {
|
||||
var d = locals[dt][dn];
|
||||
frappe.model.with_doc("Workstation", d.workstation, function(name, r) {
|
||||
d.hour_rate = r.docs[0].hour_rate;
|
||||
refresh_field("hour_rate", dn, "bom_operations");
|
||||
d.fixed_cycle_cost = r.docs[0].fixed_cycle_cost;
|
||||
refresh_field("fixed_cycle_cost", dn, "bom_operations");
|
||||
erpnext.bom.calculate_op_cost(doc);
|
||||
erpnext.bom.calculate_fixed_cost(doc);
|
||||
erpnext.bom.calculate_total(doc);
|
||||
});
|
||||
}
|
||||
frappe.ui.form.on("BOM Operation", "workstation", function(frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Workstation",
|
||||
name: d.workstation
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
|
||||
frappe.model.set_value(d.doctype, d.name, "fixed_cycle_cost", data.message.fixed_cycle_cost);
|
||||
erpnext.bom.calculate_op_cost(frm.doc);
|
||||
erpnext.bom.calculate_fixed_cost(frm.doc);
|
||||
erpnext.bom.calculate_total(frm.doc);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -40,6 +40,13 @@
|
||||
"permlevel": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "fixed_cost",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Fixed Cost",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "hour_rate",
|
||||
"fieldtype": "Currency",
|
||||
@ -52,16 +59,25 @@
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"description": "In minutes",
|
||||
"fieldname": "time_in_mins",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Operation Time ",
|
||||
"oldfieldname": "time_in_mins",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "in min",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "variable_cost",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Variable Cost",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "operating_cost",
|
||||
@ -70,22 +86,13 @@
|
||||
"label": "Operating Cost",
|
||||
"oldfieldname": "operating_cost",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "fixed_cycle_cost",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Fixed Cycle Cost",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2014-12-12 11:16:49.031521",
|
||||
"modified": "2014-12-17 15:35:21.993660",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "BOM Operation",
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function (doc, dt, dn) {
|
||||
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
cfn_set_fields(doc, dt, dn);
|
||||
|
||||
@ -75,7 +74,6 @@ $.extend(cur_frm.cscript, {
|
||||
"from_time": child.planned_start_time,
|
||||
"to_time": child.planned_end_time,
|
||||
"project": doc.project,
|
||||
"qty": doc.qty - child.qty_completed,
|
||||
"workstation": child.workstation
|
||||
},
|
||||
callback: function(r) {
|
||||
@ -164,3 +162,5 @@ cur_frm.set_query("bom_no", function(doc) {
|
||||
});
|
||||
|
||||
cur_frm.add_fetch('bom_no', 'total_fixed_cost', 'total_fixed_cost');
|
||||
cur_frm.add_fetch('bom_no', 'total_variable_cost', 'planned_variable_cost');
|
||||
cur_frm.add_fetch('bom_no', 'total_operating_cost', 'total_operating_cost');
|
||||
|
@ -191,13 +191,6 @@
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "production_item",
|
||||
"fieldname": "total_fixed_cost",
|
||||
"fieldtype": "Float",
|
||||
"label": "Total Fixed Cost",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "production_order_operations",
|
||||
"fieldtype": "Table",
|
||||
@ -207,6 +200,55 @@
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_22",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Operation Cost",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "production_item",
|
||||
"fieldname": "total_fixed_cost",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Fixed Cost",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "planned_variable_cost",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Planned Variable Cost",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "actual_variable_cost",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Actual Variable Cost",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_24",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "total_operating_cost",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Operating Cost",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"depends_on": "eval:doc.docstatus==1",
|
||||
@ -288,7 +330,7 @@
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"is_submittable": 1,
|
||||
"modified": "2014-12-01 11:36:56.832268",
|
||||
"modified": "2014-12-17 15:16:28.054620",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Order",
|
||||
|
@ -83,23 +83,13 @@
|
||||
"default": "Pending",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Status",
|
||||
"options": "Pending\nWork in Progress\nCompleted",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "qty_completed",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty Completed",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"fieldname": "workstation",
|
||||
@ -209,7 +199,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Operation Time",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "time_in_mins",
|
||||
@ -227,6 +217,7 @@
|
||||
{
|
||||
"fieldname": "planned_start_time",
|
||||
"fieldtype": "Datetime",
|
||||
"in_list_view": 0,
|
||||
"label": "Planned Start Time",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
@ -235,6 +226,7 @@
|
||||
{
|
||||
"fieldname": "planned_end_time",
|
||||
"fieldtype": "Datetime",
|
||||
"in_list_view": 0,
|
||||
"label": "Planned End Time",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
@ -305,7 +297,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2014-12-01 14:06:40.068700",
|
||||
"modified": "2014-12-17 14:38:57.959478",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Order Operation",
|
||||
|
@ -1,34 +0,0 @@
|
||||
{% var visible_columns = row.get_visible_columns(["operation",
|
||||
"opn_description", "status", "qty_completed", "workstation"]);
|
||||
%}
|
||||
|
||||
{% if(!doc) { %}
|
||||
<div class="row">
|
||||
<div class="col-sm-7">{%= __("Operation") %}</div>
|
||||
<div class="col-sm-2 text-right">{%= __("Workstation") %}</div>
|
||||
<div class="col-sm-3 text-right">{%= __("Completed Qty") %}</div>
|
||||
</div>
|
||||
{% } else { %}
|
||||
<div class="row">
|
||||
<div class="col-sm-7">
|
||||
<strong>{%= doc.operation %}</strong>
|
||||
<span class="label label-primary">
|
||||
{%= doc.status %}
|
||||
</span>
|
||||
{% include "templates/form_grid/includes/visible_cols.html" %}
|
||||
<div>
|
||||
{%= doc.get_formatted("opn_description") %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- workstation -->
|
||||
<div class="col-sm-2 text-right">
|
||||
{%= doc.get_formatted("workstation") %}
|
||||
</div>
|
||||
|
||||
<!-- qty -->
|
||||
<div class="col-sm-3 text-right">
|
||||
{%= doc.get_formatted("qty_completed") %}
|
||||
</div>
|
||||
</div>
|
||||
{% } %}
|
Loading…
x
Reference in New Issue
Block a user