mapper added, type 'Transfer' renamed to 'Material Transfer', patch added

This commit is contained in:
Neil Trini Lasrado
2014-10-27 13:34:18 +05:30
parent f24407e119
commit ce020cfb27
4 changed files with 15 additions and 7 deletions

View File

@@ -91,3 +91,4 @@ erpnext.patches.v4_2.update_requested_and_ordered_qty
erpnext.patches.v4_2.party_model erpnext.patches.v4_2.party_model
erpnext.patches.v5_0.update_frozen_accounts_permission_role erpnext.patches.v5_0.update_frozen_accounts_permission_role
erpnext.patches.v5_0.update_dn_against_doc_fields 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'")

View File

@@ -42,10 +42,14 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
this.make_supplier_quotation, this.make_supplier_quotation,
frappe.boot.doctype_icons["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, cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry,
frappe.boot.doctype_icons["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(flt(doc.per_ordered, 2) < 100) {
if(doc.material_request_type === "Purchase") if(doc.material_request_type === "Purchase")
cur_frm.add_custom_button(__('Make Purchase Order'), cur_frm.add_custom_button(__('Make Purchase Order'),
@@ -165,7 +169,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
// for backward compatibility: combine new and previous states // for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.MaterialRequestController({frm: cur_frm})); $.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]; var d = locals[cdt][cdn];
if (flt(d.qty) < flt(d.min_order_qty)) if (flt(d.qty) < flt(d.min_order_qty))
alert(__("Warning: Material Requested Qty is less than Minimum Order Qty")); alert(__("Warning: Material Requested Qty is less than Minimum Order Qty"));

View File

@@ -17,7 +17,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"in_list_view": 1, "in_list_view": 1,
"label": "Type", "label": "Type",
"options": "Purchase\nTransfer\nMaterial Issue", "options": "Purchase\nMaterial Transfer\nMaterial Issue",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
@@ -235,7 +235,7 @@
"icon": "icon-ticket", "icon": "icon-ticket",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-10-20 14:13:11.043631", "modified": "2014-10-27 12:16:38.833386",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Material Request", "name": "Material Request",

View File

@@ -73,7 +73,7 @@ class MaterialRequest(BuyingController):
from erpnext.utilities import validate_status from erpnext.utilities import validate_status
validate_status(self.status, ["Draft", "Submitted", "Stopped", "Cancelled"]) 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 = frappe.get_doc('Purchase Common')
pc_obj.validate_for_items(self) pc_obj.validate_for_items(self)
@@ -293,13 +293,16 @@ def make_supplier_quotation(source_name, target_doc=None):
@frappe.whitelist() @frappe.whitelist()
def make_stock_entry(source_name, target_doc=None): def make_stock_entry(source_name, target_doc=None):
obj = frappe.get_doc("Material Request", source_name)
def update_item(obj, target, source_parent): def update_item(obj, target, source_parent):
target.conversion_factor = 1 target.conversion_factor = 1
target.qty = flt(obj.qty) - flt(obj.ordered_qty) target.qty = flt(obj.qty) - flt(obj.ordered_qty)
target.transfer_qty = flt(obj.qty) - flt(obj.ordered_qty) target.transfer_qty = flt(obj.qty) - flt(obj.ordered_qty)
def set_missing_values(source, target): def set_missing_values(source, target):
target.purpose = "Material Transfer" target.purpose = obj.material_request_type
target.run_method("get_stock_and_rate") target.run_method("get_stock_and_rate")
doclist = get_mapped_doc("Material Request", source_name, { doclist = get_mapped_doc("Material Request", source_name, {
@@ -307,7 +310,7 @@ def make_stock_entry(source_name, target_doc=None):
"doctype": "Stock Entry", "doctype": "Stock Entry",
"validation": { "validation": {
"docstatus": ["=", 1], "docstatus": ["=", 1],
"material_request_type": ["=", "Transfer"] "material_request_type": ["=", obj.material_request_type]
} }
}, },
"Material Request Item": { "Material Request Item": {