Browse Source

MST update

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

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

@ -4,32 +4,35 @@
import frappe
from frappe.model.document import Document
class SpecialToolInformation(Document):
def validate(self):
# self.name=""
if self.is_new():
count = frappe.db.sql('''select max(my_id) as max_count from `tabSpecial Tool Information`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
if self.keywords:
self.keywords=self.keywords.strip()
if self.tool_name:
self.tool_name=self.tool_name.strip()
if self.aggregate_name:
self.aggregate_name=self.aggregate_name.strip()
self.name = self.vehicle + '-' + \
self.tool_type + '-' + self.category + '-' + self.aggregate_name
else:
self.name = self.vehicle + '-' + self.tool_type + '-' + self.category
def validate(self):
# self.name=""
if self.is_new():
count = frappe.db.sql(
'''select max(my_id) as max_count from `tabSpecial Tool Information`;''')
if count[0][0] is not None:
self.my_id = count[0][0] + 1
else:
self.my_id = 1
if self.keywords:
self.keywords = self.keywords.strip()
if self.tool_name:
self.tool_name = self.tool_name.strip()
if self.aggregate_name:
self.aggregate_name = self.aggregate_name.strip()
self.name = self.vehicle + '-' + \
self.tool_type + '-' + self.category + '-' + self.aggregate_name
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()
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:
res = check_img_ext(image)
res1 = check_png_ext(image)
@ -53,65 +56,64 @@ def file_validation(image, name, value=None):
else:
return True
else:
val = checking_image(image, 'Special Tool Information', value, name)
val = checking_image(
image, 'Special Tool Information', value, name)
if res == False:
ret = res
else:
ret = res1
return ret, 1
@frappe.whitelist()
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
if name:
child_data = frappe.db.sql(
"""select * from `tabInstructions` where parent='%s'"""%(name), as_dict=1)
for d in child_data:
if d['attach_file']:
res = False
res1 = False
res2 = False
res3 = False
if d['content_type'] == "Image":
res = check_img_ext(d['attach_file'])
res1 = check_png_ext(d['attach_file'])
elif d['content_type'] == "PDF":
res3 = check_pdf_ext(d['attach_file'])
else:
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'])
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:
child_data = frappe.db.sql(
"""select * from `tabInstructions` where parent='%s'""" % (name), as_dict=1)
for d in child_data:
if d['attach_file']:
res = False
res1 = False
res2 = False
res3 = False
if d['content_type'] == "Image":
res = check_img_ext(d['attach_file'])
res1 = check_png_ext(d['attach_file'])
elif d['content_type'] == "PDF":
res3 = check_pdf_ext(d['attach_file'])
else:
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'])

Loading…
Cancel
Save