Added Project Type new doctype to be added as link field for Project Type field in project instead of select field (#9929)
diff --git a/erpnext/config/projects.py b/erpnext/config/projects.py
index 1a70aee..a8514b2 100644
--- a/erpnext/config/projects.py
+++ b/erpnext/config/projects.py
@@ -18,6 +18,11 @@
"description": _("Project activity / task."),
},
{
+ "type": "doctype",
+ "name": "Project Type",
+ "description": _("Define Project type."),
+ },
+ {
"type": "report",
"route": "List/Task/Gantt",
"doctype": "Task",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 00f395f..2aabfc6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -426,3 +426,4 @@
erpnext.patches.v8_1.set_delivery_date_in_so_item
erpnext.patches.v8_5.fix_tax_breakup_for_non_invoice_docs
erpnext.patches.v8_5.remove_quotations_route_in_sidebar
+erpnext.patches.v8_5.update_existing_data_in_project_type
diff --git a/erpnext/patches/v8_5/update_existing_data_in_project_type.py b/erpnext/patches/v8_5/update_existing_data_in_project_type.py
new file mode 100644
index 0000000..497da06
--- /dev/null
+++ b/erpnext/patches/v8_5/update_existing_data_in_project_type.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.reload_doc("projects", "doctype", "project_type")
+ frappe.reload_doc("projects", "doctype", "project")
+
+ project_types = ["Internal", "External", "Other"]
+
+ for project_type in project_types:
+ if not frappe.db.exists("Project Type", project_type):
+ p_type = frappe.get_doc({
+ "doctype": "Project Type",
+ "project_type": project_type
+ })
+ p_type.insert()
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index 28eb730..101e4ff 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -84,7 +84,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "project_type",
- "fieldtype": "Select",
+ "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -97,7 +97,7 @@
"no_copy": 0,
"oldfieldname": "project_type",
"oldfieldtype": "Data",
- "options": "Internal\nExternal\nOther",
+ "options": "Project Type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -1255,7 +1255,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 4,
- "modified": "2017-07-19 14:36:20.857673",
+ "modified": "2017-07-26 14:36:20.857673",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
diff --git a/erpnext/projects/doctype/project_type/__init__.py b/erpnext/projects/doctype/project_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/__init__.py
diff --git a/erpnext/projects/doctype/project_type/project_type.js b/erpnext/projects/doctype/project_type/project_type.js
new file mode 100644
index 0000000..a1f941f
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/project_type.js
@@ -0,0 +1,6 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Project Type', {
+
+});
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_type/project_type.json b/erpnext/projects/doctype/project_type/project_type.json
new file mode 100644
index 0000000..b9a5b54
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/project_type.json
@@ -0,0 +1,163 @@
+{
+ "allow_copy": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 1,
+ "autoname": "field:project_type",
+ "beta": 0,
+ "creation": "2017-07-18 13:32:46.031115",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "project_type",
+ "fieldtype": "Data",
+ "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": "Project Type",
+ "length": 0,
+ "no_copy": 0,
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "description",
+ "fieldtype": "Text",
+ "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": "Description",
+ "length": 0,
+ "no_copy": 0,
+ "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,
+ "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": "2017-07-26 17:19:30.126346",
+ "modified_by": "Administrator",
+ "module": "Projects",
+ "name": "Project Type",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 0,
+ "apply_user_permissions": 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,
+ "apply_user_permissions": 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": "Projects Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Projects User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 0
+ }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_type/project_type.py b/erpnext/projects/doctype/project_type/project_type.py
new file mode 100644
index 0000000..f46876e
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/project_type.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+import frappe
+from frappe import _
+
+class ProjectType(Document):
+ def on_trash(self):
+ if self.name == "External":
+ frappe.throw(_("You cannot delete Project Type 'External'"))
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_type/test_project_type.js b/erpnext/projects/doctype/project_type/test_project_type.js
new file mode 100644
index 0000000..c2198c4
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/test_project_type.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Project Type", function (assert) {
+ let done = assert.async();
+
+ // number of asserts
+ assert.expect(1);
+
+ frappe.run_serially('Project Type', [
+ // insert a new Project Type
+ () => frappe.tests.make([
+ // values to be set
+ {key: 'value'}
+ ]),
+ () => {
+ assert.equal(cur_frm.doc.key, 'value');
+ },
+ () => done()
+ ]);
+
+});
diff --git a/erpnext/projects/doctype/project_type/test_project_type.py b/erpnext/projects/doctype/project_type/test_project_type.py
new file mode 100644
index 0000000..ee23390
--- /dev/null
+++ b/erpnext/projects/doctype/project_type/test_project_type.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+class TestProjectType(unittest.TestCase):
+ pass
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index 1301d33..f139d92 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -185,6 +185,10 @@
{'doctype': "Party Type", "party_type": "Supplier"},
{'doctype': "Party Type", "party_type": "Employee"},
+ {'doctype': "Project Type", "project_type": "Internal"},
+ {'doctype': "Project Type", "project_type": "External"},
+ {'doctype': "Project Type", "project_type": "Other"},
+
{"doctype": "Offer Term", "offer_term": _("Date of Joining")},
{"doctype": "Offer Term", "offer_term": _("Annual Salary")},
{"doctype": "Offer Term", "offer_term": _("Probationary Period")},