Browse Source

MST doctype view update n remove field in master v2 api

version2
venkata akhil 1 year ago
parent
commit
0d3602acf0
  1. 18
      smart_service/apis/v2/master.py
  2. 48
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.json

18
smart_service/apis/v2/master.py

@ -224,21 +224,21 @@ def new_publish1():
with open(BASE_PATH + str(vehicle) + '-feature_finder.json') as outfile:
data = json.load(outfile)
data = data['data']
filter_json = filter_publish_json(data,variant)
filter_json = filter_publish_json(data, variant)
data = filter_json
elif module == 'Repair/Service Check Sheet':
with open(BASE_PATH + str(vehicle) + '-repair_check_sheet.json') as outfile:
data = json.load(outfile)
data = data['data']
filter_json = filter_publish_json(data,variant)
filter_json = filter_publish_json(data, variant)
data = filter_json
elif module == 'QWIK Service':
with open(BASE_PATH + str(vehicle) + '-qwik_service.json') as outfile:
data = json.load(outfile)
data = data['data']
filter_json = filter_publish_json(data,variant)
filter_json = filter_publish_json(data, variant)
data = filter_json
elif module == 'Training Information':
@ -266,17 +266,10 @@ def new_publish1():
@frappe.whitelist(methods=['POST'], allow_guest=1)
def get_special_tool_information(vehicle):
try:
# special_tool_details = frappe.db.sql(f''' select name,vehicle,category,sub_category,display_order,
# my_id,keywords from `tabSpecial Tool Information`
# where vehicle="{vehicle}";''', as_dict=1)
special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,tool_name,aggregate_name, aggregate_image as 'tool_image',
special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type,category,aggregate_name, aggregate_image as 'tool_image',
pdf,image,video,keywords,display_order,my_id,active_status from `tabSpecial Tool Information`
where vehicle= '%s' ;''' % (vehicle), as_dict=1)
for s in special_tool_information:
# s['tool_usage_content'] = frappe.db.sql(f'''select idx as 'display_order',image,content,video,asset_type,active_status
# from `tabMST Information Assets` where parent = '{s['name']}' order by display_order;''', as_dict=1)
s['instructions'] = frappe.db.sql('''select idx as 'display_order',step_name,content_type,content,attach_file,title
from `tabInstructions` where parent = '%s' order by display_order;''' % (s['name']), as_dict=1)
return True, special_tool_information
@ -344,7 +337,8 @@ def update_publish_mapping(vehicle, variant, language, module):
doc.save()
return 1
def filter_publish_json(src_json,filter_cond):
def filter_publish_json(src_json, filter_cond):
try:
filtered_json = [src_json.get(filter_cond, None) for d in src_json]

48
smart_service/phase_2/doctype/special_tool_information/special_tool_information.json

@ -10,23 +10,21 @@
"published",
"column_break_cyo0a",
"vehicle",
"active_status",
"display_order",
"tool_type",
"keywords",
"image",
"aggregate_image",
"column_break_m3p9i",
"category",
"aggregate_name",
"column_break_whk88",
"tool_type",
"tool_name",
"pdf",
"column_break_wvkn2",
"active_status",
"display_order",
"video",
"my_id",
"section_break_e91wx",
"instructions",
"teb_instructions",
"keywords",
"pdf",
"image",
"aggregate_image",
"video"
"instructions"
],
"fields": [
{
@ -67,10 +65,6 @@
"fieldname": "section_break_e91wx",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_whk88",
"fieldtype": "Column Break"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
@ -123,24 +117,12 @@
"label": "Instructions",
"options": "Instructions"
},
{
"depends_on": "eval:doc.category !='TEB';",
"fieldname": "tool_name",
"fieldtype": "Data",
"label": "Tool Name"
},
{
"fieldname": "tool_type",
"fieldtype": "Select",
"label": "Tool Type",
"options": "New Tool\nCarry Over"
},
{
"fieldname": "teb_instructions",
"fieldtype": "Table",
"hidden": 1,
"label": "TEB Instructions",
"options": "TEB Instructions"
"options": "New Tool\nCarry Over",
"set_only_once": 1
},
{
"fieldname": "image",
@ -155,11 +137,15 @@
"fieldname": "video",
"fieldtype": "Attach",
"label": "Video"
},
{
"fieldname": "column_break_wvkn2",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-03 12:24:34.313498",
"modified": "2023-10-04 10:51:51.926504",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Special Tool Information",

Loading…
Cancel
Save