Added Project Type new doctype to be added as link field for Project Type field in project instead of select field (#9929)

This commit is contained in:
KanchanChauhan 2017-07-26 17:55:25 +05:30 committed by Makarand Bauskar
parent 53b877bd8f
commit 7800bd89dc
11 changed files with 246 additions and 3 deletions

View File

@ -17,6 +17,11 @@ def get_data():
"name": "Task",
"description": _("Project activity / task."),
},
{
"type": "doctype",
"name": "Project Type",
"description": _("Define Project type."),
},
{
"type": "report",
"route": "List/Task/Gantt",

View File

@ -426,3 +426,4 @@ erpnext.patches.v8_4.make_scorecard_records
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

View File

@ -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()

View File

@ -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",

View File

@ -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', {
});

View File

@ -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
}

View File

@ -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'"))

View File

@ -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()
]);
});

View File

@ -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

View File

@ -185,6 +185,10 @@ def install(country=None):
{'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")},