diff --git a/msp/msp/doctype/it_checklist/it_checklist.js b/msp/msp/doctype/it_checklist/it_checklist.js index 4e435f1..1944ed8 100644 --- a/msp/msp/doctype/it_checklist/it_checklist.js +++ b/msp/msp/doctype/it_checklist/it_checklist.js @@ -2,7 +2,34 @@ // For license information, please see license.txt frappe.ui.form.on('IT Checklist', { - // refresh: function(frm) { - - // } + refresh: function(frm) { + add_my_buttons(frm) + } }); + + +var add_my_buttons = function(frm) { + + if (!frm.is_new()) { + + frm.add_custom_button('fetch from Template', function(){ + frm.save() + frappe.prompt([ + {'fieldname': 'template', 'fieldtype': 'Link', 'label': 'Vorlage', 'reqd': 1, 'options': 'IT Checklist Template'}, + ], + function(values){ + frappe.call({ + method: 'msp.tools.checklist_fetch_from_template', + args: { values: values, name: frm.doc.name }, + callback:function(r){ + console.log(r.message) + frm.reload_doc() + } + })}, + 'Artikel aus Vorlage hinzufügen', + 'Artikel hinzufügen', + ) + + }); + } +} \ No newline at end of file diff --git a/msp/msp/doctype/it_checklist/it_checklist.json b/msp/msp/doctype/it_checklist/it_checklist.json index 2c6695b..90c9049 100644 --- a/msp/msp/doctype/it_checklist/it_checklist.json +++ b/msp/msp/doctype/it_checklist/it_checklist.json @@ -7,9 +7,18 @@ "engine": "InnoDB", "field_order": [ "title", - "customer", + "section_break_2", "it_landscape", - "completed_on" + "column_break_4", + "customer", + "amended_from", + "section_break_6", + "started_on", + "status", + "column_break_8", + "completed_on", + "section_break_10", + "it_checklist_elements" ], "fields": [ { @@ -18,10 +27,12 @@ "label": "Title" }, { + "fetch_from": "it_landscape.customer", "fieldname": "customer", "fieldtype": "Link", "label": "Customer", - "options": "Customer" + "options": "Customer", + "read_only": 1 }, { "fieldname": "it_landscape", @@ -33,10 +44,59 @@ "fieldname": "completed_on", "fieldtype": "Datetime", "label": "Completed on" + }, + { + "fieldname": "started_on", + "fieldtype": "Datetime", + "label": "Started on" + }, + { + "fieldname": "section_break_2", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_8", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_10", + "fieldtype": "Section Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "IT Checklist", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "it_checklist_elements", + "fieldtype": "Table", + "label": "IT Checklist Elements", + "options": "IT Checklist Element" + }, + { + "fieldname": "status", + "fieldtype": "Select", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "options": "open\nin proggress" } ], + "is_submittable": 1, "links": [], - "modified": "2022-06-17 11:22:55.055154", + "modified": "2023-03-01 23:45:23.367780", "modified_by": "Administrator", "module": "MSP", "name": "IT Checklist", diff --git a/msp/msp/doctype/it_checklist_element/__init__.py b/msp/msp/doctype/it_checklist_element/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/it_checklist_element/it_checklist_element.json b/msp/msp/doctype/it_checklist_element/it_checklist_element.json new file mode 100644 index 0000000..b06c06c --- /dev/null +++ b/msp/msp/doctype/it_checklist_element/it_checklist_element.json @@ -0,0 +1,70 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2023-03-01 22:18:31.387702", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "type", + "description", + "passed", + "falied", + "datetime", + "remark" + ], + "fields": [ + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title" + }, + { + "fieldname": "type", + "fieldtype": "Data", + "label": "Type" + }, + { + "fieldname": "description", + "fieldtype": "Data", + "label": "Description" + }, + { + "default": "0", + "fieldname": "passed", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Passed" + }, + { + "default": "0", + "fieldname": "falied", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Falied" + }, + { + "fieldname": "remark", + "fieldtype": "Markdown Editor", + "label": "Remark" + }, + { + "fieldname": "datetime", + "fieldtype": "Datetime", + "label": "Date/Time" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2023-03-01 23:31:57.867241", + "modified_by": "Administrator", + "module": "MSP", + "name": "IT Checklist Element", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/it_checklist_element/it_checklist_element.py b/msp/msp/doctype/it_checklist_element/it_checklist_element.py new file mode 100644 index 0000000..4f2e2e8 --- /dev/null +++ b/msp/msp/doctype/it_checklist_element/it_checklist_element.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ITChecklistElement(Document): + pass diff --git a/msp/msp/doctype/it_checklist_template/it_checklist_template.json b/msp/msp/doctype/it_checklist_template/it_checklist_template.json index a4902cd..0b61762 100644 --- a/msp/msp/doctype/it_checklist_template/it_checklist_template.json +++ b/msp/msp/doctype/it_checklist_template/it_checklist_template.json @@ -6,17 +6,43 @@ "editable_grid": 1, "engine": "InnoDB", "field_order": [ - "title" + "title", + "revision", + "description", + "depends_on", + "elements" ], "fields": [ { "fieldname": "title", "fieldtype": "Data", "label": "Title" + }, + { + "fieldname": "revision", + "fieldtype": "Int", + "label": "Revision" + }, + { + "fieldname": "description", + "fieldtype": "Markdown Editor", + "label": "Description" + }, + { + "fieldname": "elements", + "fieldtype": "Table", + "label": "Elements", + "options": "IT Checklist Template Element" + }, + { + "fieldname": "depends_on", + "fieldtype": "Link", + "label": "Depends On", + "options": "IT Checklist Template" } ], "links": [], - "modified": "2022-06-17 11:21:13.492067", + "modified": "2023-03-01 22:57:37.038116", "modified_by": "Administrator", "module": "MSP", "name": "IT Checklist Template", diff --git a/msp/msp/doctype/it_checklist_template_element/__init__.py b/msp/msp/doctype/it_checklist_template_element/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.json b/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.json new file mode 100644 index 0000000..9491e68 --- /dev/null +++ b/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.json @@ -0,0 +1,44 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2023-03-01 22:02:27.869078", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "type", + "description" + ], + "fields": [ + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title" + }, + { + "fieldname": "type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Type", + "options": "Check\nNote\nQuestion" + }, + { + "fieldname": "description", + "fieldtype": "Markdown Editor", + "label": "Description" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2023-03-01 23:12:57.069378", + "modified_by": "Administrator", + "module": "MSP", + "name": "IT Checklist Template Element", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.py b/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.py new file mode 100644 index 0000000..5da6fc2 --- /dev/null +++ b/msp/msp/doctype/it_checklist_template_element/it_checklist_template_element.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ITChecklistTemplateElement(Document): + pass diff --git a/msp/msp/doctype/it_landscape/it_landscape_dashboard.py b/msp/msp/doctype/it_landscape/it_landscape_dashboard.py index 7f66ea2..6ccd3c4 100644 --- a/msp/msp/doctype/it_landscape/it_landscape_dashboard.py +++ b/msp/msp/doctype/it_landscape/it_landscape_dashboard.py @@ -9,11 +9,11 @@ def get_data(): 'transactions': [ { 'label': _('Objects'), - 'items': ['IT Object', 'IT User Account', 'IP Network', 'IP Address', 'SSH Public Key' ] + 'items': ['IT Object','IT Solution', 'IT User Account', 'IP Network', 'IP Address', 'SSH Public Key' ] }, { 'label': _('Processes'), - 'items': ['IT Contract', 'ToDo'] + 'items': ['IT Checklist', 'IT Contract', 'ToDo'] } ] } diff --git a/msp/msp/doctype/it_sim_card/__init__.py b/msp/msp/doctype/it_sim_card/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/it_sim_card/it_sim_card.js b/msp/msp/doctype/it_sim_card/it_sim_card.js new file mode 100644 index 0000000..2201d10 --- /dev/null +++ b/msp/msp/doctype/it_sim_card/it_sim_card.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, itsdave GmbH and contributors +// For license information, please see license.txt + +frappe.ui.form.on('IT SIM Card', { + // refresh: function(frm) { + + // } +}); diff --git a/msp/msp/doctype/it_sim_card/it_sim_card.json b/msp/msp/doctype/it_sim_card/it_sim_card.json new file mode 100644 index 0000000..ef18274 --- /dev/null +++ b/msp/msp/doctype/it_sim_card/it_sim_card.json @@ -0,0 +1,162 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "ITSIM-.#####", + "creation": "2023-03-01 21:33:27.376883", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "provider", + "landscape", + "customer", + "iccid", + "sim_id", + "it_object", + "description", + "section_break_5", + "traffic_flat", + "traffic_month", + "sms_flat", + "sms_month", + "mobile_flat", + "mobile_month", + "national_flat", + "national_month" + ], + "fields": [ + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Title" + }, + { + "fieldname": "provider", + "fieldtype": "Select", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Provider", + "options": "Truephone\nT-Mobile\nVodafone\no2\nDigitalSim" + }, + { + "fetch_from": "customer", + "fieldname": "landscape", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Landscape", + "options": "IT Landscape", + "reqd": 1 + }, + { + "fetch_from": "landscape.customer", + "fieldname": "customer", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Customer", + "options": "Customer", + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "label": "Tariff Info" + }, + { + "default": "0", + "fieldname": "traffic_flat", + "fieldtype": "Check", + "label": "Traffic Flat" + }, + { + "fieldname": "traffic_month", + "fieldtype": "Int", + "label": "MB Traffic per Month" + }, + { + "default": "0", + "fieldname": "sms_flat", + "fieldtype": "Check", + "label": "SMS Flat" + }, + { + "fieldname": "sms_month", + "fieldtype": "Int", + "label": "SMS per Month" + }, + { + "default": "0", + "fieldname": "mobile_flat", + "fieldtype": "Check", + "label": "Mobile Call Flat" + }, + { + "fieldname": "mobile_month", + "fieldtype": "Int", + "label": "Mobile Call Minutes" + }, + { + "default": "0", + "fieldname": "national_flat", + "fieldtype": "Check", + "label": "National Flat" + }, + { + "fieldname": "national_month", + "fieldtype": "Int", + "label": "National Minutes" + }, + { + "fieldname": "it_object", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Used In IT Object", + "options": "IT Object" + }, + { + "fieldname": "description", + "fieldtype": "Markdown Editor", + "label": "Description" + }, + { + "fieldname": "iccid", + "fieldtype": "Data", + "label": "ICCID" + }, + { + "fieldname": "sim_id", + "fieldtype": "Data", + "in_standard_filter": 1, + "label": "SIM ID" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2023-03-01 22:06:52.209035", + "modified_by": "Administrator", + "module": "MSP", + "name": "IT SIM Card", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/it_sim_card/it_sim_card.py b/msp/msp/doctype/it_sim_card/it_sim_card.py new file mode 100644 index 0000000..0e54dbd --- /dev/null +++ b/msp/msp/doctype/it_sim_card/it_sim_card.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ITSIMCard(Document): + pass diff --git a/msp/msp/doctype/it_sim_card/test_it_sim_card.py b/msp/msp/doctype/it_sim_card/test_it_sim_card.py new file mode 100644 index 0000000..aed6d0f --- /dev/null +++ b/msp/msp/doctype/it_sim_card/test_it_sim_card.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and Contributors +# See license.txt + +# import frappe +import unittest + +class TestITSIMCard(unittest.TestCase): + pass diff --git a/msp/msp/doctype/it_solution/__init__.py b/msp/msp/doctype/it_solution/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/it_solution/it_solution.js b/msp/msp/doctype/it_solution/it_solution.js new file mode 100644 index 0000000..1eb92d7 --- /dev/null +++ b/msp/msp/doctype/it_solution/it_solution.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, itsdave GmbH and contributors +// For license information, please see license.txt + +frappe.ui.form.on('IT Solution', { + // refresh: function(frm) { + + // } +}); diff --git a/msp/msp/doctype/it_solution/it_solution.json b/msp/msp/doctype/it_solution/it_solution.json new file mode 100644 index 0000000..c0abf3f --- /dev/null +++ b/msp/msp/doctype/it_solution/it_solution.json @@ -0,0 +1,98 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "ITSOL-.#####", + "creation": "2023-03-01 20:42:24.507946", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "section_break_2", + "it_landscape", + "column_break_4", + "customer", + "section_break_6", + "description", + "linked_objects_section", + "linked_objects" + ], + "fields": [ + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Title" + }, + { + "fieldname": "description", + "fieldtype": "Markdown Editor", + "label": "Description" + }, + { + "fetch_from": "landscape.customer", + "fieldname": "customer", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Customer", + "options": "Customer", + "read_only": 1 + }, + { + "fieldname": "section_break_2", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, + { + "fieldname": "linked_objects_section", + "fieldtype": "Section Break", + "label": "Linked Objects" + }, + { + "fieldname": "linked_objects", + "fieldtype": "Table", + "label": "Linked Objects", + "options": "IT Solution Linked Object" + }, + { + "fieldname": "it_landscape", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Landscape", + "options": "IT Landscape" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2023-03-01 23:50:47.972136", + "modified_by": "Administrator", + "module": "MSP", + "name": "IT Solution", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/it_solution/it_solution.py b/msp/msp/doctype/it_solution/it_solution.py new file mode 100644 index 0000000..c797c28 --- /dev/null +++ b/msp/msp/doctype/it_solution/it_solution.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ITSolution(Document): + pass diff --git a/msp/msp/doctype/it_solution/test_it_solution.py b/msp/msp/doctype/it_solution/test_it_solution.py new file mode 100644 index 0000000..739b580 --- /dev/null +++ b/msp/msp/doctype/it_solution/test_it_solution.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and Contributors +# See license.txt + +# import frappe +import unittest + +class TestITSolution(unittest.TestCase): + pass diff --git a/msp/msp/doctype/it_solution_linked_object/__init__.py b/msp/msp/doctype/it_solution_linked_object/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.json b/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.json new file mode 100644 index 0000000..e7a13ad --- /dev/null +++ b/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.json @@ -0,0 +1,54 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2023-03-01 20:52:49.930360", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "document_type", + "document_id", + "title", + "descrption" + ], + "fields": [ + { + "fieldname": "document_type", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Document Type", + "options": "DocType" + }, + { + "fieldname": "document_id", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Document ID", + "options": "document_type" + }, + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title" + }, + { + "fieldname": "descrption", + "fieldtype": "Markdown Editor", + "label": "Descrption" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2023-03-01 21:11:54.675196", + "modified_by": "Administrator", + "module": "MSP", + "name": "IT Solution Linked Object", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.py b/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.py new file mode 100644 index 0000000..b9438b1 --- /dev/null +++ b/msp/msp/doctype/it_solution_linked_object/it_solution_linked_object.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ITSolutionLinkedObject(Document): + pass diff --git a/msp/msp/doctype/service_report_connected_checklist/__init__.py b/msp/msp/doctype/service_report_connected_checklist/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.json b/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.json new file mode 100644 index 0000000..35fcff1 --- /dev/null +++ b/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.json @@ -0,0 +1,49 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2023-03-01 22:27:18.743635", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "it_checklist", + "title", + "status" + ], + "fields": [ + { + "fieldname": "it_checklist", + "fieldtype": "Link", + "in_list_view": 1, + "label": "IT Checklist", + "options": "IT Checklist" + }, + { + "fetch_from": "it_checklist.status", + "fieldname": "status", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Status", + "read_only": 1 + }, + { + "fetch_from": "it_checklist.title", + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title", + "read_only": 1 + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2023-03-02 07:49:26.019057", + "modified_by": "Administrator", + "module": "MSP", + "name": "Service Report Connected Checklist", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.py b/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.py new file mode 100644 index 0000000..9cf9983 --- /dev/null +++ b/msp/msp/doctype/service_report_connected_checklist/service_report_connected_checklist.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, itsdave GmbH and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class ServiceReportConnectedChecklist(Document): + pass diff --git a/msp/msp/workspace/msp/msp.json b/msp/msp/workspace/msp/msp.json index c8b2387..1647488 100644 --- a/msp/msp/workspace/msp/msp.json +++ b/msp/msp/workspace/msp/msp.json @@ -50,6 +50,24 @@ "onboard": 0, "type": "Link" }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Solutions", + "link_to": "IT Solution", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "SIM Cards", + "link_to": "IT SIM Card", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, { "hidden": 0, "is_query_report": 0, @@ -138,7 +156,7 @@ "type": "Link" } ], - "modified": "2023-02-01 22:47:16.924689", + "modified": "2023-03-01 21:56:00.493767", "modified_by": "Administrator", "module": "MSP", "name": "MSP", @@ -157,6 +175,12 @@ "label": "Landscapes", "link_to": "IT Landscape", "type": "DocType" + }, + { + "doc_view": "List", + "label": "Solutions", + "link_to": "IT Solution", + "type": "DocType" } ] } \ No newline at end of file diff --git a/msp/tools.py b/msp/tools.py new file mode 100644 index 0000000..b937a64 --- /dev/null +++ b/msp/tools.py @@ -0,0 +1,32 @@ +import frappe +import json + +@frappe.whitelist() +def checklist_fetch_from_template(values, name): + + values_dict = json.loads(values) + template = values_dict["template"] + + template_doc = frappe.get_doc("IT Checklist Template", template) + it_checklist_doc = frappe.get_doc("IT Checklist", name) + + it_checklist_doc = get_recursive_items(template_doc, it_checklist_doc) + + it_checklist_doc.save() + + +def get_recursive_items(template_doc, it_checklist_doc): + if template_doc.depends_on: + rec_template_doc = frappe.get_doc("IT Checklist Template", template_doc.depends_on) + it_checklist_doc = get_recursive_items(rec_template_doc, it_checklist_doc) + + for element in template_doc.elements: + current_chekclist_element_doc = frappe.get_doc({ + "doctype": "IT Checklist Element", + "title": element.title, + "type": element.type, + "description": element.description + }) + it_checklist_doc.append("it_checklist_elements", current_chekclist_element_doc) + return it_checklist_doc + \ No newline at end of file diff --git a/msp/tools/hooks_methods.py b/msp/tools/hooks_methods.py deleted file mode 100644 index 962d83f..0000000 --- a/msp/tools/hooks_methods.py +++ /dev/null @@ -1,27 +0,0 @@ -import frappe -from frappe.utils import cstr - -def build_full_location_path(doctype, method=None): - parent_location_name = doctype.parent_location - full_path = '' - html_full_path = '' - has_parent_location = True if parent_location_name else False - - while has_parent_location: - result = frappe.db.get_value('Location', {'name': parent_location_name}, ['name', 'location_name', 'parent_location'], as_dict=True) - if not result: - has_parent_location = False - continue - - full_path = f"{result['location_name']} --> {full_path}" - html_full_path = f"{result['location_name']} --> {html_full_path}" - parent_location_name = result['parent_location'] - - if not parent_location_name: - has_parent_location = False - - full_path = f"{full_path} {doctype.location_name}" if full_path != '' else doctype.location_name - html_full_path = f"{html_full_path} {doctype.location_name}" if html_full_path != '' else f"{doctype.location_name}" - - doctype.full_path = full_path - doctype.html_full_path = html_full_path