[Fix] No permission for Manufacturing Settings
This commit is contained in:
parent
64b4d98778
commit
15ed7a6351
@ -13,3 +13,11 @@ class ManufacturingSettings(Document):
|
|||||||
def get_mins_between_operations():
|
def get_mins_between_operations():
|
||||||
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
||||||
"mins_between_operations")) or 10)
|
"mins_between_operations")) or 10)
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def is_material_consumption_enabled():
|
||||||
|
if not hasattr(frappe.local, 'material_consumption'):
|
||||||
|
frappe.local.material_consumption = cint(frappe.db.get_single_value('Manufacturing Settings',
|
||||||
|
'material_consumption'))
|
||||||
|
|
||||||
|
return frappe.local.material_consumption
|
||||||
@ -199,12 +199,15 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate_purpose_consumption: function(frm) {
|
validate_purpose_consumption: function(frm) {
|
||||||
frappe.model.get_value('Manufacturing Settings', {'name': 'Manufacturing Settings'}, 'material_consumption', function(d) {
|
frappe.call({
|
||||||
if (d.material_consumption==0 && frm.doc.purpose=="Material Consumption for Manufacture") {
|
method: "erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings.is_material_consumption_enabled",
|
||||||
|
}).then(r => {
|
||||||
|
if (cint(r.message) == 0
|
||||||
|
&& frm.doc.purpose=="Material Consumption for Manufacture") {
|
||||||
frm.set_value("purpose", 'Manufacture');
|
frm.set_value("purpose", 'Manufacture');
|
||||||
frappe.throw(__('Material Consumption is not set in Manufacturing Settings.'));
|
frappe.throw(__('Material Consumption is not set in Manufacturing Settings.'));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
company: function(frm) {
|
company: function(frm) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user