Merge branch 'staging-fixes' into manufacturing_settings_permissions_issue
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
index b80b0be..e88164f 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
@@ -13,3 +13,11 @@
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
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index a26992a..ccd5f36 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -199,12 +199,15 @@
},
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) {