Fixed permission issue
This commit is contained in:
parent
430810f64c
commit
d4453aef68
@ -329,39 +329,38 @@ erpnext.work_order = {
|
|||||||
|
|
||||||
if(!frm.doc.skip_transfer){
|
if(!frm.doc.skip_transfer){
|
||||||
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
|
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
|
||||||
frappe.model.get_value('Manufacturing Settings', {'name': 'Manufacturing Settings'}, 'material_consumption', function(d) {
|
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))
|
||||||
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))
|
&& frm.doc.status != 'Stopped') {
|
||||||
&& frm.doc.status != 'Stopped') {
|
frm.has_finish_btn = true;
|
||||||
frm.has_finish_btn = true;
|
|
||||||
|
|
||||||
if (d.material_consumption == 1) {
|
if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
|
||||||
// Only show "Material Consumption" when required_qty > consumed_qty
|
// Only show "Material Consumption" when required_qty > consumed_qty
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var tbl = frm.doc.required_items || [];
|
var tbl = frm.doc.required_items || [];
|
||||||
var tbl_lenght = tbl.length;
|
var tbl_lenght = tbl.length;
|
||||||
for (var i = 0, len = tbl_lenght; i < len; i++) {
|
for (var i = 0, len = tbl_lenght; i < len; i++) {
|
||||||
if (flt(frm.doc.required_items[i].required_qty) > flt(frm.doc.required_items[i].consumed_qty)) {
|
if (flt(frm.doc.required_items[i].required_qty) > flt(frm.doc.required_items[i].consumed_qty)) {
|
||||||
counter += 1;
|
counter += 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (counter > 0) {
|
|
||||||
var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() {
|
|
||||||
erpnext.work_order.make_consumption_se(frm, d.backflush_raw_materials_based_on);
|
|
||||||
});
|
|
||||||
consumption_btn.addClass('btn-primary');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (counter > 0) {
|
||||||
var finish_btn = frm.add_custom_button(__('Finish'), function() {
|
var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() {
|
||||||
erpnext.work_order.make_se(frm, 'Manufacture');
|
const backflush_raw_materials_based_on = frm.doc.__onload.backflush_raw_materials_based_on;
|
||||||
});
|
erpnext.work_order.make_consumption_se(frm, backflush_raw_materials_based_on);
|
||||||
|
});
|
||||||
if(doc.material_transferred_for_manufacturing>=doc.qty) {
|
consumption_btn.addClass('btn-primary');
|
||||||
// all materials transferred for manufacturing, make this primary
|
|
||||||
finish_btn.addClass('btn-primary');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
var finish_btn = frm.add_custom_button(__('Finish'), function() {
|
||||||
|
erpnext.work_order.make_se(frm, 'Manufacture');
|
||||||
|
});
|
||||||
|
|
||||||
|
if(doc.material_transferred_for_manufacturing>=doc.qty) {
|
||||||
|
// all materials transferred for manufacturing, make this primary
|
||||||
|
finish_btn.addClass('btn-primary');
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
|
||||||
var finish_btn = frm.add_custom_button(__('Finish'), function() {
|
var finish_btn = frm.add_custom_button(__('Finish'), function() {
|
||||||
|
|||||||
@ -31,6 +31,12 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class WorkOrder(Document):
|
class WorkOrder(Document):
|
||||||
|
def onload(self):
|
||||||
|
ms = frappe.get_doc("Manufacturing Settings")
|
||||||
|
self.set_onload("material_consumption", ms.material_consumption)
|
||||||
|
self.set_onload("backflush_raw_materials_based_on", ms.backflush_raw_materials_based_on)
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_production_item()
|
self.validate_production_item()
|
||||||
if self.bom_no:
|
if self.bom_no:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user