mapper added, type 'Transfer' renamed to 'Material Transfer', patch added
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 7c895bb..d5f2ccb 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -91,3 +91,4 @@
erpnext.patches.v4_2.party_model
erpnext.patches.v5_0.update_frozen_accounts_permission_role
erpnext.patches.v5_0.update_dn_against_doc_fields
+execute:frappe.db.sql("update `tabMaterial Request` set material_request_type = 'Material Transfer' where material_request_type = 'Transfer'")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 147a3b1..54c1d8f 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -42,9 +42,13 @@
this.make_supplier_quotation,
frappe.boot.doctype_icons["Supplier Quotation"]);
- if(doc.material_request_type === "Transfer" && doc.status === "Submitted")
+ if(doc.material_request_type === "Material Transfer" && doc.status === "Submitted")
cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry,
frappe.boot.doctype_icons["Stock Entry"]);
+
+ if(doc.material_request_type === "Material Issue" && doc.status === "Submitted")
+ cur_frm.add_custom_button(__("Issue Material"), this.make_stock_entry,
+ frappe.boot.doctype_icons["Stock Entry"]);
if(flt(doc.per_ordered, 2) < 100) {
if(doc.material_request_type === "Purchase")
@@ -165,7 +169,7 @@
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.MaterialRequestController({frm: cur_frm}));
-cur_frm.cscript.qty = function(doc, cdt, cdn) {
+cur_frm.cscript.qty = function(cdt, cdn) {
var d = locals[cdt][cdn];
if (flt(d.qty) < flt(d.min_order_qty))
alert(__("Warning: Material Requested Qty is less than Minimum Order Qty"));
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 4b93d60..6107778 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -17,7 +17,7 @@
"fieldtype": "Select",
"in_list_view": 1,
"label": "Type",
- "options": "Purchase\nTransfer\nMaterial Issue",
+ "options": "Purchase\nMaterial Transfer\nMaterial Issue",
"permlevel": 0,
"reqd": 1
},
@@ -235,7 +235,7 @@
"icon": "icon-ticket",
"idx": 1,
"is_submittable": 1,
- "modified": "2014-10-20 14:13:11.043631",
+ "modified": "2014-10-27 12:16:38.833386",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request",
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 3217513..715f66b 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -73,7 +73,7 @@
from erpnext.utilities import validate_status
validate_status(self.status, ["Draft", "Submitted", "Stopped", "Cancelled"])
- self.validate_value("material_request_type", "in", ["Purchase", "Transfer", "Material Issue"])
+ self.validate_value("material_request_type", "in", ["Purchase", "Material Transfer", "Material Issue"])
pc_obj = frappe.get_doc('Purchase Common')
pc_obj.validate_for_items(self)
@@ -293,13 +293,16 @@
@frappe.whitelist()
def make_stock_entry(source_name, target_doc=None):
+
+ obj = frappe.get_doc("Material Request", source_name)
+
def update_item(obj, target, source_parent):
target.conversion_factor = 1
target.qty = flt(obj.qty) - flt(obj.ordered_qty)
target.transfer_qty = flt(obj.qty) - flt(obj.ordered_qty)
def set_missing_values(source, target):
- target.purpose = "Material Transfer"
+ target.purpose = obj.material_request_type
target.run_method("get_stock_and_rate")
doclist = get_mapped_doc("Material Request", source_name, {
@@ -307,7 +310,7 @@
"doctype": "Stock Entry",
"validation": {
"docstatus": ["=", 1],
- "material_request_type": ["=", "Transfer"]
+ "material_request_type": ["=", obj.material_request_type]
}
},
"Material Request Item": {