Browse Source

MST update

version2
venkataakhil 1 year ago
parent
commit
b0d435934c
  1. 64
      smart_service/phase_2/doctype/instructions/instructions.json
  2. 49
      smart_service/phase_2/doctype/module_publish_mapping/module_publish_mapping.json
  3. 3
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.js
  4. 150
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.py

64
smart_service/phase_2/doctype/instructions/instructions.json

@ -1,64 +0,0 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-09-21 17:56:22.177272",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"step_name",
"content_type",
"title",
"content",
"attach_file"
],
"fields": [
{
"fieldname": "step_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Step Name"
},
{
"fieldname": "content_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Content Type",
"options": "Heading\nDescription\nCaution\nWarning\nNotice\nImage\nVideo\nPDF",
"read_only_depends_on": "// eval:doc.content_type == 'PDF'",
"set_only_once": 1
},
{
"fieldname": "content",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Content",
"read_only_depends_on": "// eval:doc.content_type=='Image'"
},
{
"depends_on": "// eval:doc.content_type == 'Image'",
"fieldname": "attach_file",
"fieldtype": "Attach",
"in_list_view": 1,
"label": "Attach File",
"read_only_depends_on": "// eval:doc.content_type =='Heading';"
},
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Title"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-05 17:29:43.636314",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Instructions",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC"
}

49
smart_service/phase_2/doctype/module_publish_mapping/module_publish_mapping.json

@ -1,6 +1,4 @@
{ {
"_comments": "[]",
"_liked_by": "[]",
"actions": [], "actions": [],
"allow_rename": 1, "allow_rename": 1,
"autoname": "format:{vehicle}-{variant}-{language}-{publish_type}", "autoname": "format:{vehicle}-{variant}-{language}-{publish_type}",
@ -34,83 +32,97 @@
{ {
"fieldname": "vehicle", "fieldname": "vehicle",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Vehicle" "label": "Vehicle",
"set_only_once": 1
}, },
{ {
"fieldname": "variant", "fieldname": "variant",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Variant" "label": "Variant",
"set_only_once": 1
}, },
{ {
"fieldname": "language", "fieldname": "language",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Language" "label": "Language",
"set_only_once": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "automotive_system", "fieldname": "automotive_system",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Automotive System" "label": "Automotive System",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "tsb", "fieldname": "tsb",
"fieldtype": "Check", "fieldtype": "Check",
"label": "TSB" "label": "TSB",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "fsa", "fieldname": "fsa",
"fieldtype": "Check", "fieldtype": "Check",
"label": "FSA" "label": "FSA",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "tekalert", "fieldname": "tekalert",
"fieldtype": "Check", "fieldtype": "Check",
"label": "TEKalert" "label": "TEKalert",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "feature_finder", "fieldname": "feature_finder",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Feature Finder" "label": "Feature Finder",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "repairservice_check_sheet", "fieldname": "repairservice_check_sheet",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Repair/Service Check Sheet" "label": "Repair/Service Check Sheet",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "mahindra_special_tool_information", "fieldname": "mahindra_special_tool_information",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Mahindra Special Tool Information" "label": "Mahindra Special Tool Information",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "training_information", "fieldname": "training_information",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Training Information" "label": "Training Information",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "qwik_service", "fieldname": "qwik_service",
"fieldtype": "Check", "fieldtype": "Check",
"label": "QWIK Service" "label": "QWIK Service",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "pdi_inspection", "fieldname": "pdi_inspection",
"fieldtype": "Check", "fieldtype": "Check",
"label": "PDI Inspection" "label": "PDI Inspection",
"read_only": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "torque_information_nm", "fieldname": "torque_information_nm",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Torque Information NM" "label": "Torque Information NM",
"read_only": 1
}, },
{ {
"fieldname": "publish_type", "fieldname": "publish_type",
@ -118,7 +130,8 @@
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Publish Type", "label": "Publish Type",
"options": "\nInternal\nGlobal" "options": "\nInternal\nGlobal",
"set_only_once": 1
}, },
{ {
"fieldname": "column_break_2y76a", "fieldname": "column_break_2y76a",
@ -143,7 +156,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2023-09-04 17:40:33.938964", "modified": "2023-10-06 12:18:41.170342",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Phase-2", "module": "Phase-2",
"name": "Module Publish Mapping", "name": "Module Publish Mapping",

3
smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

@ -63,7 +63,8 @@ frappe.ui.form.on('Special Tool Information', {
} }
}); });
} }
frm.doc.name = frm.doc.vehicle + "-" + frm.doc.tool_type + "-" + frm.doc.category + "-" + frm.doc.aggregate_name
// frm.doc.name = frm.doc.vehicle + "-" + frm.doc.tool_type + "-" + frm.doc.category + "-" + frm.doc.aggregate_name
if (frm.doc.image) { if (frm.doc.image) {
frappe.call({ frappe.call({

150
smart_service/phase_2/doctype/special_tool_information/special_tool_information.py

@ -4,32 +4,35 @@
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
class SpecialToolInformation(Document): class SpecialToolInformation(Document):
def validate(self): def validate(self):
# self.name="" # self.name=""
if self.is_new(): if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabSpecial Tool Information`;''') count = frappe.db.sql(
if count[0][0] is not None: '''select max(my_id) as max_count from `tabSpecial Tool Information`;''')
self.my_id = count[0][0] + 1 if count[0][0] is not None:
else: self.my_id = count[0][0] + 1
self.my_id = 1 else:
if self.keywords: self.my_id = 1
self.keywords=self.keywords.strip() if self.keywords:
if self.tool_name: self.keywords = self.keywords.strip()
self.tool_name=self.tool_name.strip() if self.tool_name:
if self.aggregate_name: self.tool_name = self.tool_name.strip()
self.aggregate_name=self.aggregate_name.strip() if self.aggregate_name:
self.name = self.vehicle + '-' + \ self.aggregate_name = self.aggregate_name.strip()
self.tool_type + '-' + self.category + '-' + self.aggregate_name self.name = self.vehicle + '-' + \
else: self.tool_type + '-' + self.category + '-' + self.aggregate_name
self.name = self.vehicle + '-' + self.tool_type + '-' + self.category else:
self.name = self.vehicle + '-' + self.tool_type + '-' + self.category
if not self.is_new() and self.published == 1:
self.published = 0
if not self.is_new() and self.published == 1:
self.published = 0
@frappe.whitelist() @frappe.whitelist()
def file_validation(image, name, value=None): def file_validation(image, name, value=None):
from smart_service.apis.utils import check_png_ext, check_img_ext, check_zip_ext, check_pdf_ext,checking_image, details_of_image,check_mp4_ext ,get_file_size from smart_service.apis.utils import check_png_ext, check_img_ext, check_zip_ext, check_pdf_ext, checking_image, details_of_image, check_mp4_ext, get_file_size
if image: if image:
res = check_img_ext(image) res = check_img_ext(image)
res1 = check_png_ext(image) res1 = check_png_ext(image)
@ -53,65 +56,64 @@ def file_validation(image, name, value=None):
else: else:
return True return True
else: else:
val = checking_image(image, 'Special Tool Information', value, name) val = checking_image(
image, 'Special Tool Information', value, name)
if res == False: if res == False:
ret = res ret = res
else: else:
ret = res1 ret = res1
return ret, 1 return ret, 1
@frappe.whitelist() @frappe.whitelist()
def file_validation_child(name, value=None): def file_validation_child(name, value=None):
from smart_service.apis.utils import check_png_ext, check_img_ext, check_zip_ext, check_pdf_ext, details_of_image, checking_image, check_mp4_ext, get_file_size from smart_service.apis.utils import check_png_ext, check_img_ext, check_zip_ext, check_pdf_ext, details_of_image, checking_image, check_mp4_ext, get_file_size
if name: if name:
child_data = frappe.db.sql( child_data = frappe.db.sql(
"""select * from `tabInstructions` where parent='%s'"""%(name), as_dict=1) """select * from `tabInstructions` where parent='%s'""" % (name), as_dict=1)
for d in child_data: for d in child_data:
if d['attach_file']: if d['attach_file']:
res = False res = False
res1 = False res1 = False
res2 = False res2 = False
res3 = False res3 = False
if d['content_type'] == "Image": if d['content_type'] == "Image":
res = check_img_ext(d['attach_file']) res = check_img_ext(d['attach_file'])
res1 = check_png_ext(d['attach_file']) res1 = check_png_ext(d['attach_file'])
elif d['content_type'] == "PDF": elif d['content_type'] == "PDF":
res3 = check_pdf_ext(d['attach_file']) res3 = check_pdf_ext(d['attach_file'])
else: else:
res2 = check_mp4_ext(d['attach_file']) res2 = check_mp4_ext(d['attach_file'])
if res == True or res1 == True:
width, height, size = details_of_image(
d['attach_file'])
if width > 1280 or height > 720 or size > 1*1024 and d['attach_file']:
val = checking_image(
d['attach_file'], "Special Tool Information", value, name, 1)
frappe.delete_doc("Instructions", d['name'])
if val == True:
return False, d['idx']
else:
return True
elif res2 == True:
video_size_mb = get_file_size(d['attach_file'])
if video_size_mb > 10:
frappe.delete_doc('Instructions', d['name'])
return (False, d['idx'])
elif res3 == True:
pdf_size_mb = get_file_size(d['attach_file'])
if pdf_size_mb > 1:
frappe.delete_doc('Instructions',d['name'])
return (False, d['idx'])
else:
if res == False and res1==False:
ret = res
elif res2 == False:
ret = res2
else:
ret = res3
val = checking_image(
d['attach_file'], 'Special Tool Information', value, name, 1)
frappe.delete_doc('Instructions', d['name'])
return (ret, d['idx'])
if res == True or res1 == True:
width, height, size = details_of_image(
d['attach_file'])
if width > 1280 or height > 720 or size > 1*1024 and d['attach_file']:
val = checking_image(
d['attach_file'], "Special Tool Information", value, name, 1)
frappe.delete_doc("Instructions", d['name'])
if val == True:
return False, d['idx']
else:
return True
elif res2 == True:
video_size_mb = get_file_size(d['attach_file'])
if video_size_mb > 10:
frappe.delete_doc('Instructions', d['name'])
return (False, d['idx'])
elif res3 == True:
pdf_size_mb = get_file_size(d['attach_file'])
if pdf_size_mb > 1:
frappe.delete_doc('Instructions', d['name'])
return (False, d['idx'])
else:
if res == False and res1 == False:
ret = res
elif res2 == False:
ret = res2
else:
ret = res3
val = checking_image(
d['attach_file'], 'Special Tool Information', value, name, 1)
frappe.delete_doc('Instructions', d['name'])
return (ret, d['idx'])

Loading…
Cancel
Save