From e25cfac60949cc9ebe93261c1ca795fe11cb3cc8 Mon Sep 17 00:00:00 2001 From: venkata akhil Date: Thu, 19 Oct 2023 16:34:16 +0530 Subject: [PATCH] mst category master --- smart_service/apis/v2/master.py | 2 +- .../doctype/instructions/instructions.json | 4 +- .../special_tool_information.json | 22 ++++--- .../__init__.py | 0 ...pecial_tool_information_category_master.js | 8 +++ ...cial_tool_information_category_master.json | 62 +++++++++++++++++++ ...pecial_tool_information_category_master.py | 15 +++++ ...pecial_tool_information_category_master.py | 8 +++ .../transactions/doctype/publish/publish.py | 1 - 9 files changed, 110 insertions(+), 12 deletions(-) create mode 100644 smart_service/phase_2/doctype/special_tool_information_category_master/__init__.py create mode 100644 smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.js create mode 100644 smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.json create mode 100644 smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.py create mode 100644 smart_service/phase_2/doctype/special_tool_information_category_master/test_special_tool_information_category_master.py diff --git a/smart_service/apis/v2/master.py b/smart_service/apis/v2/master.py index 023418c..6c1600b 100644 --- a/smart_service/apis/v2/master.py +++ b/smart_service/apis/v2/master.py @@ -335,7 +335,7 @@ def new_publish1(): def get_special_tool_information(vehicle): try: special_tool_information = frappe.db.sql('''select name,vehicle,tool_type,category,aggregate_name,tool_name,aggregate_image as 'tool_image', - pdf,image,video,keywords,display_order,my_id,active_status from `tabSpecial Tool Information` + pdf,image,video,keywords,display_order,category_display_order,my_id,active_status from `tabSpecial Tool Information` where vehicle= '%s' ;''' % (vehicle), as_dict=1) for s in special_tool_information: s['instructions'] = frappe.db.sql('''select idx as 'display_order',step_name, content_type, content,attach_file,title diff --git a/smart_service/phase_2/doctype/instructions/instructions.json b/smart_service/phase_2/doctype/instructions/instructions.json index 211c5b2..f6ea8fb 100644 --- a/smart_service/phase_2/doctype/instructions/instructions.json +++ b/smart_service/phase_2/doctype/instructions/instructions.json @@ -32,7 +32,7 @@ "fieldtype": "Small Text", "in_list_view": 1, "label": "Content", - "mandatory_depends_on": "eval:doc.step_name && doc.content_type !='Image' ||doc.content_type !='Video'||doc.content_type !='PDF'" + "mandatory_depends_on": "eval:doc.step_name && doc.content_type !='Image'||doc.content_type !='Video'||doc.content_type !='PDF';" }, { "fieldname": "attach_file", @@ -50,7 +50,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2023-10-18 14:57:50.775053", + "modified": "2023-10-19 16:33:47.404474", "modified_by": "Administrator", "module": "Phase-2", "name": "Instructions", diff --git a/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json b/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json index 5e92ddc..67147da 100644 --- a/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json +++ b/smart_service/phase_2/doctype/special_tool_information/special_tool_information.json @@ -25,7 +25,8 @@ "image_preview", "my_id", "section_break_e91wx", - "instructions" + "instructions", + "category_display_order" ], "fields": [ { @@ -100,13 +101,12 @@ }, { "fieldname": "category", - "fieldtype": "Select", + "fieldtype": "Link", "in_list_view": 1, "in_standard_filter": 1, "label": "Category", - "options": "Maintenance Service Category (MS)\nRepair Service Category (RS)\nOverhaul Service Category (OS)\nTEB", - "reqd": 1, - "set_only_once": 1 + "options": "Special Tool Information Category Master", + "reqd": 1 }, { "depends_on": "eval:doc.category !='TEB';", @@ -137,7 +137,7 @@ "fieldname": "image", "fieldtype": "Attach Image", "label": "Image", - "reqd": 1 + "mandatory_depends_on": "eval:doc.category!=\"TEB\";" }, { "fieldname": "column_break_m3p9i", @@ -168,12 +168,18 @@ "in_list_view": 1, "in_standard_filter": 1, "label": "Tool Name", - "reqd": 1 + "mandatory_depends_on": "eval:doc.category!=\"TEB\";" + }, + { + "fetch_from": "category.display_order", + "fieldname": "category_display_order", + "fieldtype": "Int", + "label": "Category Display Order" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-10-18 12:43:38.818592", + "modified": "2023-10-19 16:14:57.349719", "modified_by": "Administrator", "module": "Phase-2", "name": "Special Tool Information", diff --git a/smart_service/phase_2/doctype/special_tool_information_category_master/__init__.py b/smart_service/phase_2/doctype/special_tool_information_category_master/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.js b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.js new file mode 100644 index 0000000..99adb05 --- /dev/null +++ b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Special Tool Information Category Master', { + // refresh: function(frm) { + + // } +}); diff --git a/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.json b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.json new file mode 100644 index 0000000..21996be --- /dev/null +++ b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.json @@ -0,0 +1,62 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "format:{category_name}", + "creation": "2023-10-19 15:53:02.286633", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "category_name", + "display_order", + "my_id", + "active_status" + ], + "fields": [ + { + "fieldname": "category_name", + "fieldtype": "Data", + "label": "Category Name", + "unique": 1 + }, + { + "fieldname": "display_order", + "fieldtype": "Int", + "label": "Display Order" + }, + { + "fieldname": "my_id", + "fieldtype": "Int", + "label": "My Id" + }, + { + "fieldname": "active_status", + "fieldtype": "Select", + "label": "Active Status", + "options": "Active\nInactive" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2023-10-19 15:56:03.355802", + "modified_by": "Administrator", + "module": "Phase-2", + "name": "Special Tool Information Category Master", + "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/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.py b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.py new file mode 100644 index 0000000..4724d09 --- /dev/null +++ b/smart_service/phase_2/doctype/special_tool_information_category_master/special_tool_information_category_master.py @@ -0,0 +1,15 @@ +# Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + +class SpecialToolInformationCategoryMaster(Document): + def autoname(self): + + count = frappe.db.sql( + '''select max(my_id) as max_count from `tabSpecial Tool Information Category Master`;''') + if count[0][0] is not None: + self.my_id = count[0][0] + 1 + else: + self.my_id = 1 diff --git a/smart_service/phase_2/doctype/special_tool_information_category_master/test_special_tool_information_category_master.py b/smart_service/phase_2/doctype/special_tool_information_category_master/test_special_tool_information_category_master.py new file mode 100644 index 0000000..c0a6b1c --- /dev/null +++ b/smart_service/phase_2/doctype/special_tool_information_category_master/test_special_tool_information_category_master.py @@ -0,0 +1,8 @@ +# Copyright (c) 2023, Hard n Soft Technologies Pvt Ltd and Contributors +# See license.txt + +# import frappe +import unittest + +class TestSpecialToolInformationCategoryMaster(unittest.TestCase): + pass diff --git a/smart_service/transactions/doctype/publish/publish.py b/smart_service/transactions/doctype/publish/publish.py index 3ed18dd..fbd27e9 100644 --- a/smart_service/transactions/doctype/publish/publish.py +++ b/smart_service/transactions/doctype/publish/publish.py @@ -125,7 +125,6 @@ class Publish(Document): """update `tabPublish` set publish_status='Published' where name='{0}'""".format(self.name)) variant = self.variant_mapping_details.split('/n') - frappe.log_error('publish type', str(self.publish_type)) update_publish_mapping(self.vehicle, self.variant_mapping, self.language, self.publish_module, self.publish_type)