feat: added stock entry type master to select purpose in the stock entry
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 34bb803..a993ab8 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -452,6 +452,7 @@
 		stock_entry.address_display = purchase_order.address_display
 		stock_entry.company = purchase_order.company
 		stock_entry.to_warehouse = purchase_order.supplier_warehouse
+		stock_entry.set_stock_entry_type()
 
 		for item_code in fg_items:
 			for rm_item_data in rm_items_list:
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 976b24f..6793062 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -568,6 +568,7 @@
 	stock_entry.bom_no = production_order.bom_no
 	stock_entry.use_multi_level_bom = production_order.use_multi_level_bom
 	stock_entry.fg_completed_qty = qty or (flt(production_order.qty) - flt(production_order.produced_qty))
+	stock_entry.set_stock_entry_type()
 
 	if purpose=="Material Transfer for Manufacture":
 		stock_entry.to_warehouse = wip_warehouse
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 59a88d4..c89e99a 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -625,6 +625,7 @@
 			additional_costs = get_additional_costs(work_order, fg_qty=stock_entry.fg_completed_qty)
 			stock_entry.set("additional_costs", additional_costs)
 
+	stock_entry.set_stock_entry_type()
 	stock_entry.get_items()
 	return stock_entry.as_dict()
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f082dd1..d882d22 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -591,4 +591,5 @@
 erpnext.patches.v12_0.update_pricing_rule_fields
 erpnext.patches.v11_1.make_job_card_time_logs
 erpnext.patches.v12_0.rename_pricing_rule_child_doctypes
-erpnext.patches.v12_0.move_target_distribution_from_parent_to_child #wmnfb
+erpnext.patches.v12_0.move_target_distribution_from_parent_to_child
+erpnext.patches.v12_0.stock_entry_enhancements
diff --git a/erpnext/patches/v12_0/gst_update_hsn_code_in_stock_entry.py b/erpnext/patches/v12_0/gst_update_hsn_code_in_stock_entry.py
deleted file mode 100644
index 2d16f6f..0000000
--- a/erpnext/patches/v12_0/gst_update_hsn_code_in_stock_entry.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-
-from __future__ import unicode_literals
-import frappe
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
-
-def execute():
-    company = frappe.get_cached_value("Company", {'country': 'India'}, 'name')
-    if not company:
-        return
-
-    custom_fields = {
-        'Stock Entry Detail': [dict(fieldname='gst_hsn_code', label='HSN/SAC',
-            fieldtype='Data', fetch_from='item_code.gst_hsn_code',
-            insert_after='description', allow_on_submit=1, print_hide=0)]
-    }
-
-    create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch, update=True)
-
-    frappe.db.sql(""" update `tabStock Entry Detail`, `tabItem`
-        SET
-            `tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
-        Where
-            `tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
-    """)
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/stock_entry_enhancements.py b/erpnext/patches/v12_0/stock_entry_enhancements.py
new file mode 100644
index 0000000..0521e60
--- /dev/null
+++ b/erpnext/patches/v12_0/stock_entry_enhancements.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+
+from __future__ import unicode_literals
+import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
+def execute():
+    create_stock_entry_types()
+
+    company = frappe.get_cached_value("Company", {'country': 'India'}, 'name')
+    if company:
+        pass
+        # add_gst_hsn_code_field()
+
+def create_stock_entry_types():
+    frappe.reload_doc('stock', 'doctype', 'stock_entry_type')
+
+    for purpose in ["Material Issue", "Material Receipt", "Material Transfer",
+        "Material Transfer for Manufacture", "Material Consumption for Manufacture", "Manufacture",
+        "Repack", "Subcontract"]:
+        ste_type = frappe.get_doc({
+            'doctype': 'Stock Entry Type',
+            'name': purpose,
+            'purpose': purpose
+        })
+
+        try:
+            ste_type.insert()
+        except frappe.DuplicateEntryError:
+            pass
+
+def add_gst_hsn_code_field():
+    custom_fields = {
+        'Stock Entry Detail': [dict(fieldname='gst_hsn_code', label='HSN/SAC',
+            fieldtype='Data', fetch_from='item_code.gst_hsn_code',
+            insert_after='description', allow_on_submit=1, print_hide=0)]
+    }
+
+    create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch, update=True)
+
+    frappe.db.sql(""" update `tabStock Entry Detail`, `tabItem`
+        SET
+            `tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
+        Where
+            `tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
+    """)
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index d21de0e..7bd6d16 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -82,6 +82,17 @@
 		{'doctype': 'Employment Type', 'employee_type_name': _('Intern')},
 		{'doctype': 'Employment Type', 'employee_type_name': _('Apprentice')},
 
+
+		# Stock Entry Type
+		{'doctype': 'Stock Entry Type', 'name': 'Material Issue', 'purpose': 'Material Issue'},
+		{'doctype': 'Stock Entry Type', 'name': 'Material Receipt', 'purpose': 'Material Receipt'},
+		{'doctype': 'Stock Entry Type', 'name': 'Material Transfer', 'purpose': 'Material Transfer'},
+		{'doctype': 'Stock Entry Type', 'name': 'Manufacture', 'purpose': 'Manufacture'},
+		{'doctype': 'Stock Entry Type', 'name': 'Repack', 'purpose': 'Repack'},
+		{'doctype': 'Stock Entry Type', 'name': 'Subcontract', 'purpose': 'Subcontract'},
+		{'doctype': 'Stock Entry Type', 'name': 'Material Transfer for Manufacture', 'purpose': 'Material Transfer for Manufacture'},
+		{'doctype': 'Stock Entry Type', 'name': 'Material Consumption for Manufacture', 'purpose': 'Material Consumption for Manufacture'},
+
 		# Designation
 		{'doctype': 'Designation', 'designation_name': _('CEO')},
 		{'doctype': 'Designation', 'designation_name': _('Manager')},
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 7a199a4..99cdcb6 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -426,6 +426,7 @@
 			target.purpose = "Material Receipt"
 
 		target.run_method("calculate_rate_and_amount")
+		target.set_stock_entry_type()
 		target.set_job_card_data()
 
 	doclist = get_mapped_doc("Material Request", source_name, {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 6a925ad..f17b64b 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -21,6 +21,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "items_section",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -54,6 +55,7 @@
    "collapsible": 0,
    "columns": 0,
    "default": "{purpose}",
+   "fetch_if_empty": 0,
    "fieldname": "title",
    "fieldtype": "Data",
    "hidden": 1,
@@ -87,6 +89,7 @@
    "collapsible": 0,
    "columns": 0,
    "default": "",
+   "fetch_if_empty": 0,
    "fieldname": "naming_series",
    "fieldtype": "Select",
    "hidden": 0,
@@ -118,10 +121,46 @@
    "allow_bulk_edit": 0,
    "allow_in_quick_entry": 0,
    "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "stock_entry_type",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Stock Entry Type",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Stock Entry Type",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
    "bold": 1,
    "collapsible": 0,
    "columns": 0,
-   "default": "Material Issue",
+   "default": "",
+   "fetch_from": "stock_entry_type.purpose",
+   "fetch_if_empty": 0,
    "fieldname": "purpose",
    "fieldtype": "Select",
    "hidden": 0,
@@ -140,7 +179,7 @@
    "permlevel": 0,
    "print_hide": 0,
    "print_hide_if_no_value": 0,
-   "read_only": 0,
+   "read_only": 1,
    "remember_last_selected_value": 0,
    "report_hide": 0,
    "reqd": 1,
@@ -156,6 +195,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "company",
    "fieldtype": "Link",
    "hidden": 0,
@@ -191,6 +231,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:in_list([\"Material Transfer for Manufacture\", \"Manufacture\", \"Material Consumption for Manufacture\"], doc.purpose)",
+   "fetch_if_empty": 0,
    "fieldname": "work_order",
    "fieldtype": "Link",
    "hidden": 0,
@@ -226,6 +267,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Subcontract\"",
+   "fetch_if_empty": 0,
    "fieldname": "purchase_order",
    "fieldtype": "Link",
    "hidden": 0,
@@ -260,6 +302,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "delivery_note_no",
    "fieldtype": "Link",
    "hidden": 0,
@@ -295,6 +338,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "sales_invoice_no",
    "fieldtype": "Link",
    "hidden": 0,
@@ -328,6 +372,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Purchase Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "purchase_receipt_no",
    "fieldtype": "Link",
    "hidden": 0,
@@ -362,72 +407,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
-   "depends_on": "eval:in_list([\"Material Issue\", \"Material Transfer\", \"Manufacture\", \"Repack\", \t\t\t\t\t\"Subcontract\", \"Material Transfer for Manufacture\", \"Material Consumption for Manufacture\"], doc.purpose)",
-   "fieldname": "from_bom",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "From BOM",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
-  },
-  {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "inspection_required",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Inspection Required",
-   "length": 0,
-   "no_copy": 0,
-   "options": "",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "translatable": 0,
-   "unique": 0
-  },
-  {
-   "allow_bulk_edit": 0,
-   "allow_in_quick_entry": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "col2",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -463,6 +443,7 @@
    "columns": 0,
    "default": "Today",
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "posting_date",
    "fieldtype": "Date",
    "hidden": 0,
@@ -497,6 +478,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "",
+   "fetch_if_empty": 0,
    "fieldname": "posting_time",
    "fieldtype": "Time",
    "hidden": 0,
@@ -531,6 +513,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.docstatus==0",
+   "fetch_if_empty": 0,
    "fieldname": "set_posting_time",
    "fieldtype": "Check",
    "hidden": 0,
@@ -563,7 +546,76 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
+   "fieldname": "inspection_required",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Inspection Required",
+   "length": 0,
+   "no_copy": 0,
+   "options": "",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:in_list([\"Material Issue\", \"Material Transfer\", \"Manufacture\", \"Repack\", \t\t\t\t\t\"Subcontract\", \"Material Transfer for Manufacture\", \"Material Consumption for Manufacture\"], doc.purpose)",
+   "fetch_if_empty": 0,
+   "fieldname": "from_bom",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "From BOM",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "translatable": 0,
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_in_quick_entry": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
    "depends_on": "eval: doc.from_bom && (doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
+   "fetch_if_empty": 0,
    "fieldname": "sb1",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -596,6 +648,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "from_bom",
+   "fetch_if_empty": 0,
    "fieldname": "bom_no",
    "fieldtype": "Link",
    "hidden": 0,
@@ -630,6 +683,7 @@
    "columns": 0,
    "depends_on": "from_bom",
    "description": "As per Stock UOM",
+   "fetch_if_empty": 0,
    "fieldname": "fg_completed_qty",
    "fieldtype": "Float",
    "hidden": 0,
@@ -663,6 +717,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "cb1",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -696,6 +751,7 @@
    "default": "1",
    "depends_on": "from_bom",
    "description": "Including items for sub assemblies",
+   "fetch_if_empty": 0,
    "fieldname": "use_multi_level_bom",
    "fieldtype": "Check",
    "hidden": 0,
@@ -728,6 +784,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "from_bom",
+   "fetch_if_empty": 0,
    "fieldname": "get_items",
    "fieldtype": "Button",
    "hidden": 0,
@@ -760,6 +817,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "section_break_12",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -791,6 +849,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "from_warehouse",
    "fieldtype": "Link",
    "hidden": 0,
@@ -826,6 +885,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "from_warehouse",
+   "fetch_if_empty": 0,
    "fieldname": "source_warehouse_address",
    "fieldtype": "Link",
    "hidden": 0,
@@ -859,6 +919,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "source_address_display",
    "fieldtype": "Small Text",
    "hidden": 0,
@@ -891,6 +952,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "cb0",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -921,6 +983,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "to_warehouse",
    "fieldtype": "Link",
    "hidden": 0,
@@ -956,6 +1019,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "to_warehouse",
+   "fetch_if_empty": 0,
    "fieldname": "target_warehouse_address",
    "fieldtype": "Link",
    "hidden": 0,
@@ -989,6 +1053,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "target_address_display",
    "fieldtype": "Small Text",
    "hidden": 0,
@@ -1021,6 +1086,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "sb0",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1052,6 +1118,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "scan_barcode",
    "fieldtype": "Data",
    "hidden": 0,
@@ -1084,6 +1151,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "items",
    "fieldtype": "Table",
    "hidden": 0,
@@ -1119,6 +1187,7 @@
    "collapsible": 0,
    "columns": 0,
    "description": "",
+   "fetch_if_empty": 0,
    "fieldname": "get_stock_and_rate",
    "fieldtype": "Button",
    "hidden": 0,
@@ -1152,6 +1221,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "section_break_19",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1183,6 +1253,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "total_incoming_value",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1216,6 +1287,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_22",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -1247,6 +1319,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "total_outgoing_value",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1280,6 +1353,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "value_difference",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1314,6 +1388,7 @@
    "collapsible": 1,
    "collapsible_depends_on": "total_additional_costs",
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "additional_costs_section",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1346,6 +1421,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "additional_costs",
    "fieldtype": "Table",
    "hidden": 0,
@@ -1379,6 +1455,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "total_additional_costs",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1413,6 +1490,7 @@
    "collapsible": 1,
    "columns": 0,
    "depends_on": "eval: in_list([\"Sales Return\", \"Purchase Return\", \"Subcontract\"], doc.purpose)",
+   "fetch_if_empty": 0,
    "fieldname": "contact_section",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1445,6 +1523,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
+   "fetch_if_empty": 0,
    "fieldname": "supplier",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1480,6 +1559,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
+   "fetch_if_empty": 0,
    "fieldname": "supplier_name",
    "fieldtype": "Data",
    "hidden": 0,
@@ -1514,6 +1594,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
+   "fetch_if_empty": 0,
    "fieldname": "supplier_address",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1548,6 +1629,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "address_display",
    "fieldtype": "Small Text",
    "hidden": 0,
@@ -1580,6 +1662,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "column_break_39",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -1612,6 +1695,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "customer",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1647,6 +1731,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "customer_name",
    "fieldtype": "Data",
    "hidden": 0,
@@ -1681,6 +1766,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "eval:doc.purpose==\"Sales Return\"",
+   "fetch_if_empty": 0,
    "fieldname": "customer_address",
    "fieldtype": "Small Text",
    "hidden": 0,
@@ -1714,6 +1800,7 @@
    "bold": 0,
    "collapsible": 1,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "printing_settings",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1746,6 +1833,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "select_print_heading",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1780,6 +1868,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "letter_head",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1813,6 +1902,7 @@
    "bold": 0,
    "collapsible": 1,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "more_info",
    "fieldtype": "Section Break",
    "hidden": 0,
@@ -1845,6 +1935,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "project",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1878,6 +1969,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "remarks",
    "fieldtype": "Text",
    "hidden": 0,
@@ -1911,6 +2003,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "col5",
    "fieldtype": "Column Break",
    "hidden": 0,
@@ -1944,6 +2037,7 @@
    "collapsible": 0,
    "columns": 0,
    "depends_on": "total_amount",
+   "fetch_if_empty": 0,
    "fieldname": "total_amount",
    "fieldtype": "Currency",
    "hidden": 0,
@@ -1976,6 +2070,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "job_card",
    "fieldtype": "Link",
    "hidden": 0,
@@ -2009,6 +2104,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "amended_from",
    "fieldtype": "Link",
    "hidden": 0,
@@ -2043,6 +2139,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
+   "fetch_if_empty": 0,
    "fieldname": "credit_note",
    "fieldtype": "Link",
    "hidden": 1,
@@ -2081,7 +2178,7 @@
  "issingle": 0,
  "istable": 0,
  "max_attachments": 0,
- "modified": "2018-10-18 04:42:41.452572",
+ "modified": "2019-03-13 16:36:37.491243",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock Entry",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 1149c3d..3518fc6 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -478,6 +478,11 @@
 		if self.purpose not in ['Manufacture', 'Repack']:
 			self.total_amount = sum([flt(item.amount) for item in self.get("items")])
 
+	def set_stock_entry_type(self):
+		if not self.stock_entry_type and self.purpose:
+			self.stock_entry_type = frappe.get_cached_value('Stock Entry Type',
+				{'purpose': self.purpose}, 'name')
+
 	def validate_purchase_order(self):
 		"""Throw exception if more raw material is transferred against Purchase Order than in
 		the raw materials supplied table"""
@@ -1138,6 +1143,7 @@
 	stock_entry = frappe.new_doc("Stock Entry")
 	stock_entry.company = company
 	stock_entry.purpose = "Material Transfer"
+	stock_entry.set_stock_entry_type()
 	for item in items:
 		if item.get('sample_quantity') and item.get('batch_no'):
 			sample_quantity = validate_sample_quantity(item.get('item_code'), item.get('sample_quantity'),
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
index 7a34338..49a3095 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
@@ -124,6 +124,7 @@
 		'expense_account': args.expense_account
 	})
 
+	s.set_stock_entry_type()
 	if not args.do_not_save:
 		s.insert()
 		if not args.do_not_submit:
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 448e2db..c04962e 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -239,6 +239,7 @@
 		repack = frappe.copy_doc(test_records[3])
 		repack.posting_date = nowdate()
 		repack.posting_time = nowtime()
+		repack.set_stock_entry_type()
 		repack.insert()
 		repack.submit()
 
@@ -272,6 +273,8 @@
 				"amount": 200
 			},
 		])
+
+		repack.set_stock_entry_type()
 		repack.insert()
 		repack.submit()
 
@@ -327,6 +330,7 @@
 	def test_serial_no_not_reqd(self):
 		se = frappe.copy_doc(test_records[0])
 		se.get("items")[0].serial_no = "ABCD"
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoNotRequiredError, se.submit)
 
@@ -335,6 +339,7 @@
 		se.get("items")[0].item_code = "_Test Serialized Item"
 		se.get("items")[0].qty = 2
 		se.get("items")[0].transfer_qty = 2
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoRequiredError, se.submit)
 
@@ -344,6 +349,7 @@
 		se.get("items")[0].qty = 2
 		se.get("items")[0].serial_no = "ABCD\nEFGH\nXYZ"
 		se.get("items")[0].transfer_qty = 2
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoQtyError, se.submit)
 
@@ -353,6 +359,7 @@
 		se.get("items")[0].qty = 2
 		se.get("items")[0].serial_no = "ABCD"
 		se.get("items")[0].transfer_qty = 2
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoQtyError, se.submit)
 
@@ -362,6 +369,7 @@
 		se.get("items")[0].qty = 2
 		se.get("items")[0].serial_no = "ABCD\nEFGH"
 		se.get("items")[0].transfer_qty = 2
+		se.set_stock_entry_type()
 		se.insert()
 		se.submit()
 
@@ -382,6 +390,7 @@
 		se.get("items")[0].t_warehouse = None
 		se.get("items")[0].serial_no = "ABCD\nEFGH"
 		se.get("items")[0].transfer_qty = 2
+		se.set_stock_entry_type()
 		se.insert()
 
 		self.assertRaises(SerialNoNotExistsError, se.submit)
@@ -394,6 +403,7 @@
 		se.get("items")[0].qty = 1
 		se.get("items")[0].serial_no = serial_nos[0]
 		se.get("items")[0].transfer_qty = 1
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoDuplicateError, se.submit)
 
@@ -420,6 +430,7 @@
 		se.get("items")[0].serial_no = serial_nos[0]
 		se.get("items")[0].s_warehouse = "_Test Warehouse - _TC"
 		se.get("items")[0].t_warehouse = "_Test Warehouse 1 - _TC"
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoItemError, se.submit)
 
@@ -435,6 +446,7 @@
 		se.get("items")[0].serial_no = serial_no
 		se.get("items")[0].s_warehouse = "_Test Warehouse - _TC"
 		se.get("items")[0].t_warehouse = "_Test Warehouse 1 - _TC"
+		se.set_stock_entry_type()
 		se.insert()
 		se.submit()
 		self.assertTrue(frappe.db.get_value("Serial No", serial_no, "warehouse"), "_Test Warehouse 1 - _TC")
@@ -456,6 +468,7 @@
 		se.get("items")[0].serial_no = serial_nos[0]
 		se.get("items")[0].s_warehouse = "_Test Warehouse 1 - _TC"
 		se.get("items")[0].t_warehouse = "_Test Warehouse - _TC"
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(SerialNoWarehouseError, se.submit)
 
@@ -476,6 +489,7 @@
 		from erpnext.stock.utils import InvalidWarehouseCompany
 		st1 = frappe.copy_doc(test_records[0])
 		st1.get("items")[0].t_warehouse="_Test Warehouse 2 - _TC1"
+		st1.set_stock_entry_type()
 		st1.insert()
 		self.assertRaises(InvalidWarehouseCompany, st1.submit)
 
@@ -506,6 +520,7 @@
 		st1.get("items")[0].t_warehouse="_Test Warehouse 2 - _TC1"
 		st1.get("items")[0].expense_account = "Stock Adjustment - _TC1"
 		st1.get("items")[0].cost_center = "Main - _TC1"
+		st1.set_stock_entry_type()
 		st1.insert()
 		st1.submit()
 
@@ -529,6 +544,7 @@
 		se = frappe.copy_doc(test_records[0])
 		se.set_posting_time = 1
 		se.posting_date = add_days(nowdate(), -15)
+		se.set_stock_entry_type()
 		se.insert()
 		self.assertRaises(StockFreezeError, se.submit)
 		frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
@@ -737,6 +753,7 @@
 	if target_warehouse:
 		se.get("items")[0].t_warehouse = target_warehouse
 
+	se.set_stock_entry_type()
 	se.insert()
 	se.submit()
 	return se
diff --git a/erpnext/stock/doctype/stock_entry_type/__init__.py b/erpnext/stock/doctype/stock_entry_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/stock/doctype/stock_entry_type/__init__.py
diff --git a/erpnext/stock/doctype/stock_entry_type/stock_entry_type.js b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.js
new file mode 100644
index 0000000..c554278
--- /dev/null
+++ b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Stock Entry Type', {
+	// refresh: function(frm) {
+
+	// }
+});
diff --git a/erpnext/stock/doctype/stock_entry_type/stock_entry_type.json b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.json
new file mode 100644
index 0000000..799e835
--- /dev/null
+++ b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.json
@@ -0,0 +1,156 @@
+{
+ "allow_copy": 0, 
+ "allow_events_in_timeline": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "Prompt", 
+ "beta": 0, 
+ "creation": "2019-03-13 16:23:46.636769", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Material Issue", 
+   "fetch_if_empty": 0, 
+   "fieldname": "purpose", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Purpose", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nMaterial Issue\nMaterial Receipt\nMaterial Transfer\nMaterial Transfer for Manufacture\nMaterial Consumption for Manufacture\nManufacture\nRepack\nSubcontract", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "translatable": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2019-03-13 16:28:02.326991", 
+ "modified_by": "Administrator", 
+ "module": "Stock", 
+ "name": "Stock Entry Type", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "System Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Manufacturing Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Stock Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Stock User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "ASC", 
+ "track_changes": 1, 
+ "track_seen": 0, 
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
new file mode 100644
index 0000000..a4116ab
--- /dev/null
+++ b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+# import frappe
+from frappe.model.document import Document
+
+class StockEntryType(Document):
+	pass
diff --git a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
new file mode 100644
index 0000000..4fa73fd
--- /dev/null
+++ b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+class TestStockEntryType(unittest.TestCase):
+	pass