Merge pull request #16093 from rohitwaghchaure/manufacturing_settings_permissions_issue
[Fix] No permission for Manufacturing Settings
This commit is contained in:
commit
5f7b37ee11
@ -13,3 +13,11 @@ class ManufacturingSettings(Document):
|
||||
def get_mins_between_operations():
|
||||
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
||||
"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) {
|
||||
frappe.model.get_value('Manufacturing Settings', {'name': 'Manufacturing Settings'}, 'material_consumption', function(d) {
|
||||
if (d.material_consumption==0 && frm.doc.purpose=="Material Consumption for Manufacture") {
|
||||
frappe.call({
|
||||
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');
|
||||
frappe.throw(__('Material Consumption is not set in Manufacturing Settings.'));
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
company: function(frm) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user