Solutions, SIM Card Manaagement, Dynamic Links, Checklists

This commit is contained in:
dave 2023-03-02 07:53:04 +01:00
parent cb6fbb333a
commit 8e2cae0a5f
29 changed files with 738 additions and 39 deletions

View File

@ -2,7 +2,34 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('IT Checklist', { 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',
)
});
}
}

View File

@ -7,9 +7,18 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"title", "title",
"customer", "section_break_2",
"it_landscape", "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": [ "fields": [
{ {
@ -18,10 +27,12 @@
"label": "Title" "label": "Title"
}, },
{ {
"fetch_from": "it_landscape.customer",
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Customer", "label": "Customer",
"options": "Customer" "options": "Customer",
"read_only": 1
}, },
{ {
"fieldname": "it_landscape", "fieldname": "it_landscape",
@ -33,10 +44,59 @@
"fieldname": "completed_on", "fieldname": "completed_on",
"fieldtype": "Datetime", "fieldtype": "Datetime",
"label": "Completed on" "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": [], "links": [],
"modified": "2022-06-17 11:22:55.055154", "modified": "2023-03-01 23:45:23.367780",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "MSP", "module": "MSP",
"name": "IT Checklist", "name": "IT Checklist",

View File

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

View File

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

View File

@ -6,17 +6,43 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"title" "title",
"revision",
"description",
"depends_on",
"elements"
], ],
"fields": [ "fields": [
{ {
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Title" "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": [], "links": [],
"modified": "2022-06-17 11:21:13.492067", "modified": "2023-03-01 22:57:37.038116",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "MSP", "module": "MSP",
"name": "IT Checklist Template", "name": "IT Checklist Template",

View File

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

View File

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

View File

@ -9,11 +9,11 @@ def get_data():
'transactions': [ 'transactions': [
{ {
'label': _('Objects'), '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'), 'label': _('Processes'),
'items': ['IT Contract', 'ToDo'] 'items': ['IT Checklist', 'IT Contract', 'ToDo']
} }
] ]
} }

View File

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
# Copyright (c) 2023, itsdave GmbH and Contributors
# See license.txt
# import frappe
import unittest
class TestITSIMCard(unittest.TestCase):
pass

View File

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
# Copyright (c) 2023, itsdave GmbH and Contributors
# See license.txt
# import frappe
import unittest
class TestITSolution(unittest.TestCase):
pass

View File

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

View File

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

View File

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

View File

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

View File

@ -50,6 +50,24 @@
"onboard": 0, "onboard": 0,
"type": "Link" "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, "hidden": 0,
"is_query_report": 0, "is_query_report": 0,
@ -138,7 +156,7 @@
"type": "Link" "type": "Link"
} }
], ],
"modified": "2023-02-01 22:47:16.924689", "modified": "2023-03-01 21:56:00.493767",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "MSP", "module": "MSP",
"name": "MSP", "name": "MSP",
@ -157,6 +175,12 @@
"label": "Landscapes", "label": "Landscapes",
"link_to": "IT Landscape", "link_to": "IT Landscape",
"type": "DocType" "type": "DocType"
},
{
"doc_view": "List",
"label": "Solutions",
"link_to": "IT Solution",
"type": "DocType"
} }
] ]
} }

32
msp/tools.py Normal file
View File

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

View File

@ -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"<a href='http://{cstr(frappe.local.site)}/app/location/{result['name']}' target='_blank'>{result['location_name']}</a> --> {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} <a href='http://{cstr(frappe.local.site)}/app/location/{doctype.name}' target='_blank'>{doctype.location_name}</a>" if html_full_path != '' else f"<a href='{doctype.name}'>{doctype.location_name}</a>"
doctype.full_path = full_path
doctype.html_full_path = html_full_path