Add option to skip material transfer for production orders
This commit is contained in:
parent
c44910370b
commit
7544904857
@ -72,15 +72,17 @@ frappe.ui.form.on("Production Order", {
|
|||||||
message = title;
|
message = title;
|
||||||
|
|
||||||
// pending qty
|
// pending qty
|
||||||
var pending_complete = frm.doc.material_transferred_for_manufacturing - frm.doc.produced_qty;
|
if(!frm.doc.skip_transfer){
|
||||||
if(pending_complete) {
|
var pending_complete = frm.doc.material_transferred_for_manufacturing - frm.doc.produced_qty;
|
||||||
var title = __('{0} items in progress', [pending_complete]);
|
if(pending_complete) {
|
||||||
bars.push({
|
var title = __('{0} items in progress', [pending_complete]);
|
||||||
'title': title,
|
bars.push({
|
||||||
'width': ((pending_complete / frm.doc.qty * 100) - added_min) + '%',
|
'title': title,
|
||||||
'progress_class': 'progress-bar-warning'
|
'width': ((pending_complete / frm.doc.qty * 100) - added_min) + '%',
|
||||||
})
|
'progress_class': 'progress-bar-warning'
|
||||||
message = message + '. ' + title;
|
})
|
||||||
|
message = message + '. ' + title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
frm.dashboard.add_progress(__('Status'), bars, message);
|
frm.dashboard.add_progress(__('Status'), bars, message);
|
||||||
}
|
}
|
||||||
@ -122,21 +124,32 @@ erpnext.production_order = {
|
|||||||
frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unstop Production Order'], __("Status"));
|
frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unstop Production Order'], __("Status"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flt(doc.material_transferred_for_manufacturing) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
if(!frm.doc.skip_transfer){
|
||||||
|
if ((flt(doc.material_transferred_for_manufacturing) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
||||||
frm.has_start_btn = true;
|
frm.has_start_btn = true;
|
||||||
var btn = frm.add_custom_button(__('Start'),
|
var btn = frm.add_custom_button(__('Start'),
|
||||||
cur_frm.cscript['Transfer Raw Materials']);
|
cur_frm.cscript['Transfer Raw Materials']);
|
||||||
btn.addClass('btn-primary');
|
btn.addClass('btn-primary');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) && frm.doc.status != 'Stopped') {
|
if(!frm.doc.skip_transfer){
|
||||||
frm.has_finish_btn = true;
|
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) && frm.doc.status != 'Stopped') {
|
||||||
var btn = frm.add_custom_button(__('Finish'),
|
frm.has_finish_btn = true;
|
||||||
cur_frm.cscript['Update Finished Goods']);
|
var btn = frm.add_custom_button(__('Finish'),
|
||||||
|
cur_frm.cscript['Update Finished Goods']);
|
||||||
|
|
||||||
if(doc.material_transferred_for_manufacturing==doc.qty) {
|
if(doc.material_transferred_for_manufacturing==doc.qty) {
|
||||||
// all materials transferred for manufacturing,
|
// all materials transferred for manufacturing,
|
||||||
// make this primary
|
// make this primary
|
||||||
|
btn.addClass('btn-primary');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(frm.doc.skip_transfer){
|
||||||
|
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
||||||
|
frm.has_finish_btn = true;
|
||||||
|
var btn = frm.add_custom_button(__('Finish'),
|
||||||
|
cur_frm.cscript['Update Finished Goods']);
|
||||||
btn.addClass('btn-primary');
|
btn.addClass('btn-primary');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,9 +248,15 @@ $.extend(cur_frm.cscript, {
|
|||||||
|
|
||||||
make_se: function(purpose) {
|
make_se: function(purpose) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var max = (purpose === "Manufacture") ?
|
if(!this.frm.doc.skip_transfer){
|
||||||
flt(this.frm.doc.material_transferred_for_manufacturing) - flt(this.frm.doc.produced_qty) :
|
var max = (purpose === "Manufacture") ?
|
||||||
flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_manufacturing);
|
flt(this.frm.doc.material_transferred_for_manufacturing) - flt(this.frm.doc.produced_qty) :
|
||||||
|
flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_manufacturing);
|
||||||
|
} else if(this.frm.doc.skip_transfer){
|
||||||
|
var max = (purpose === "Manufacture") ?
|
||||||
|
flt(this.frm.doc.qty) - flt(this.frm.doc.produced_qty) :
|
||||||
|
flt(this.frm.doc.qty) - flt(this.frm.doc.produced_qty);
|
||||||
|
}
|
||||||
|
|
||||||
frappe.prompt({fieldtype:"Float", label: __("Qty for {0}", [purpose]), fieldname:"qty",
|
frappe.prompt({fieldtype:"Float", label: __("Qty for {0}", [purpose]), fieldname:"qty",
|
||||||
description: __("Max: {0}", [max]), 'default': max },
|
description: __("Max: {0}", [max]), 'default': max },
|
||||||
|
|||||||
@ -318,6 +318,36 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"description": "Check if material transfer entry is not required",
|
||||||
|
"fieldname": "skip_transfer",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Skip Material Transfer",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
|
|||||||
@ -535,7 +535,7 @@ def make_stock_entry(production_order_id, purpose, qty=None):
|
|||||||
stock_entry.from_warehouse = production_order.wip_warehouse
|
stock_entry.from_warehouse = production_order.wip_warehouse
|
||||||
stock_entry.to_warehouse = production_order.fg_warehouse
|
stock_entry.to_warehouse = production_order.fg_warehouse
|
||||||
additional_costs = get_additional_costs(production_order, fg_qty=stock_entry.fg_completed_qty)
|
additional_costs = get_additional_costs(production_order, fg_qty=stock_entry.fg_completed_qty)
|
||||||
stock_entry.project = frappe.db.get_value("Stock Entry",{"production_order": production_order_id,"purpose": "Material Transfer for Manufacture"}, "project")
|
stock_entry.project = production_order.project
|
||||||
stock_entry.set("additional_costs", additional_costs)
|
stock_entry.set("additional_costs", additional_costs)
|
||||||
|
|
||||||
stock_entry.get_items()
|
stock_entry.get_items()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user