Browse Source

UI level fixes, remove active status, SOP name change field

version2
venkataakhil 1 year ago
parent
commit
d5849db677
  1. 94
      smart_service/phase_2/doctype/feature_finder/feature_finder.js
  2. 13
      smart_service/phase_2/doctype/feature_finder_category_master/feature_finder_category_master.json
  3. 10
      smart_service/phase_2/doctype/feature_finder_content/feature_finder_content.json
  4. 12
      smart_service/phase_2/doctype/feature_finder_disclaimer/feature_finder_disclaimer.json
  5. 10
      smart_service/phase_2/doctype/feature_finder_images/feature_finder_images.json
  6. 12
      smart_service/phase_2/doctype/feature_finder_master/feature_finder_master.js
  7. 11
      smart_service/phase_2/doctype/feature_finder_publish_data/feature_finder_publish_data.json
  8. 10
      smart_service/phase_2/doctype/feature_finder_publish_docs/feature_finder_publish_docs.json
  9. 10
      smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json
  10. 12
      smart_service/phase_2/doctype/mst_information_assets/mst_information_assets.json
  11. 11
      smart_service/phase_2/doctype/repair_check_publish_docs/repair_check_publish_docs.json
  12. 10
      smart_service/phase_2/doctype/repair_service_child/repair_service_child.json
  13. 11
      smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json
  14. 13
      smart_service/phase_2/doctype/training_information/training_information.json
  15. 10
      smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json
  16. 98
      smart_service/transactions/doctype/publish/publish.py

94
smart_service/phase_2/doctype/feature_finder/feature_finder.js

@ -16,6 +16,23 @@ frappe.ui.form.on('Feature Finder', {
set_display_order(frm)
show_images(frm)
var is_sop =1
if(frm.doc.post_vin_cutoff_id_tab && frm.doc.post_vin_cutoff_id_tab.length>0){
frm.doc.post_vin_cutoff_id_tab.map(v=>{
if(v.post_vin_cutoff_name=="SOP"){
is_sop=0
}
})
}
if(is_sop==1){
var childTable = cur_frm.add_child("post_vin_cutoff_id_tab");
childTable.post_vin_cutoff_name="SOP"
cur_frm.refresh_fields("post_vin_cutoff_id_tab");
}
},
onload: function (frm) {
if (!frm.doc.feature_finder_images){
@ -231,7 +248,13 @@ function custom_tab_html(frm) {
frm.doc.post_vin_cutoff_id_tab.map(val => {
ret += '<li class="nav-item">'
if(val.post_vin_cutoff_name=="SOP"){
// ret += '<a class="nav-link" id="' + val.post_vin_cutoff_name + '" value=' + val.post_vin_cutoff_name + ' data-toggle="tab" role="tab">' + val.post_vin_cutoff_name + '</a>'
}
else{
ret += '<a class="nav-link" id="' + val.post_vin_cutoff_name + '" value=' + val.post_vin_cutoff_name + ' data-toggle="tab" role="tab">PV-' + val.post_vin_cutoff_name + '</a>'
}
ret += '</li>'
})
@ -285,7 +308,7 @@ function custom_tab_html(frm) {
nav_spec.feature_type = "Post Vin CutOff"
nav_spec.post_vin_cutoff_name = frm.doc.tab_ref
}
nav_spec.active_status = "Active"
// nav_spec.active_status = "Active"
all_tabs()
$('.main').find('.nav-link').click(function (event) {
@ -377,7 +400,7 @@ function custom_tab_html(frm) {
<th style="width: 7%;" class="specifiction"><input type="checkbox" id="checkAll"' class="grid-row-check pull-left"><span class='spec_check'>No</span></th>
<th>Specification</th>
<th>Value</th>
<th>Active Status</th>
<th><a><svg class="icon icon-sm" style="filter: opacity(0.5)">
<use class="" href="#icon-setting-gear"></use>
@ -393,7 +416,6 @@ function custom_tab_html(frm) {
<tr>
<th style="width: 7%;" class="feature_image"><input type="checkbox" id="imgcheckAll"' class="grid-row-check pull-left"><span class='image_check'>No</span></th>
<th>Image</th>
<th>Active Status</th>
<th><a><svg class="icon icon-sm" style="filter: opacity(0.5)">
<use class="" href="#icon-setting-gear"></use>
@ -409,7 +431,6 @@ function custom_tab_html(frm) {
<tr>
<th style="width: 7%;" class="feature_content"><input type="checkbox" id="contentcheckAll"' class="grid-row-check pull-left"><span class='content_check'>No</span></th>
<th>Content</th>
<th>Active Status</th>
<th><a><svg class="icon icon-sm" style="filter: opacity(0.5)">
<use class="" href="#icon-setting-gear"></use>
@ -433,7 +454,7 @@ function custom_tab_html(frm) {
spec_custom_dt += '<td style="width: 7%;" id="spec_count"><input id=' + val.name + ' type="checkbox" class="speccheck grid-row-check pull-left"><span class="spec_check">' + specification_count + '</span></td>'
spec_custom_dt += '<td>' + val.specification + '</td>'
spec_custom_dt += '<td>' + val.value + '</td>'
spec_custom_dt += '<td>' + val.active_status + '</td>'
// spec_custom_dt += '<td>' + val.active_status + '</td>'
// spec_custom_dt += '<td>' + val.feature_type + '</td>'
// if (val.post_vin_cutoff_name) {
// spec_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
@ -460,7 +481,7 @@ function custom_tab_html(frm) {
// image_custom_dt += '<tr>'
image_custom_dt += '<td style="width: 7%;" id="image_count"><input id=' + val.name + ' type="checkbox" class="imagecheck grid-row-check pull-left"><span class="image_check">' + image_count + '</span></td>'
image_custom_dt += '<td>' + val.image + '</td>'
image_custom_dt += '<td>' + val.active_status + '</td>'
// image_custom_dt += '<td>' + val.active_status + '</td>'
// image_custom_dt += '<td>' + val.feature_type + '</td>'
// if (val.post_vin_cutoff_name) {
// image_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
@ -486,7 +507,7 @@ function custom_tab_html(frm) {
// content_custom_dt += '<tr>'
content_custom_dt += '<td style="width: 7%;" id="cont_count"><input id=' + val.name + ' type="checkbox" class="contentcheck grid-row-check pull-left"><span class="content_check">' + content_count + '</span></td>'
content_custom_dt += '<td>' + val.content + '</td>'
content_custom_dt += '<td>' + val.active_status + '</td>'
// content_custom_dt += '<td>' + val.active_status + '</td>'
// content_custom_dt += '<td>' + val.feature_type + '</td>'
// if (val.post_vin_cutoff_name) {
// content_custom_dt += '<td>' + val.post_vin_cutoff_name + '</td>'
@ -509,21 +530,21 @@ function custom_tab_html(frm) {
spec_custom_dt += '</tbody>'
spec_custom_dt += '</table>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_delete">Delete</button>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_add">Add Row</button>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary btn-primary grid-add-row spec_custom_add">Add Row</button>'
spec_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row spec_custom_save">Save</button>'
image_custom_dt += '</tbody>'
image_custom_dt += '</table>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_delete">Delete</button>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_add">Add Row</button>'
image_custom_dt += '<button class="btn btn-xs btn-secondary btn-primary grid-add-row image_custom_add">Add Row</button>'
image_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row image_custom_save">Save</button>'
content_custom_dt += '</tbody>'
content_custom_dt += '</table>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_delete">Delete</button>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_add">Add Row</button>'
content_custom_dt += '<button class="btn btn-xs btn-secondary btn-primary grid-add-row content_custom_add">Add Row</button>'
content_custom_dt += '<button class="btn btn-xs btn-secondary grid-add-row content_custom_save">Save</button>'
//button end
@ -884,13 +905,13 @@ function custom_tab_html(frm) {
fieldtype: 'Data',
default: spec_dialog_value.value
},
{
label: 'Active Status',
fieldname: 'active_status',
fieldtype: 'Select',
options: "Active\nInactive",
default: spec_dialog_value.active_status
},
// {
// label: 'Active Status',
// fieldname: 'active_status',
// fieldtype: 'Select',
// options: "Active\nInactive",
// default: spec_dialog_value.active_status
// },
{
label: 'Feature Type',
fieldname: 'feature_type',
@ -955,13 +976,13 @@ function custom_tab_html(frm) {
default: image_dialog_value.image
},
{
label: 'Active Status',
fieldname: 'active_status',
fieldtype: 'Select',
options: "Active\nInactive",
default: image_dialog_value.active_status
},
// {
// label: 'Active Status',
// fieldname: 'active_status',
// fieldtype: 'Select',
// options: "Active\nInactive",
// default: image_dialog_value.active_status
// },
{
label: 'Feature Type',
fieldname: 'feature_type',
@ -1026,13 +1047,13 @@ function custom_tab_html(frm) {
default: content_dialog_value.content,
},
{
label: 'Active Status',
fieldname: 'active_status',
fieldtype: 'Select',
options: "Active\nInactive",
default: content_dialog_value.active_status
},
// {
// label: 'Active Status',
// fieldname: 'active_status',
// fieldtype: 'Select',
// options: "Active\nInactive",
// default: content_dialog_value.active_status
// },
{
label: 'Feature Type',
fieldname: 'feature_type',
@ -1116,13 +1137,12 @@ function set_display_order(frm) {
});
}
// frappe.ui.form.on('Feature Finder Specification', {
// specification_add: function (frm, cdt, cdn) {
// frappe.ui.form.on('Post Vin Cutoff ID', {
// post_vin_cutoff_id_tab_add: function (frm, cdt, cdn) {
// console.log("calling callling")
// var child2 = locals[cdt][cdn];
// child2.post_vin_cutoff_name = filter_value
// refresh_field("specification");
// child2.post_vin_cutoff_name = "SOP"
// refresh_field("post_vin_cutoff_name");
// }
// })

13
smart_service/phase_2/doctype/feature_finder_category_master/feature_finder_category_master.json

@ -8,7 +8,8 @@
"engine": "InnoDB",
"field_order": [
"feature_category",
"feature_name"
"feature_name",
"active_status"
],
"fields": [
{
@ -29,11 +30,19 @@
"reqd": 1,
"set_only_once": 1,
"unique": 1
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Active Status",
"options": "Active\nInactive"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-04 15:35:06.625979",
"modified": "2023-09-01 16:12:43.761230",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Category Master",

10
smart_service/phase_2/doctype/feature_finder_content/feature_finder_content.json

@ -7,7 +7,6 @@
"engine": "InnoDB",
"field_order": [
"content",
"active_status",
"feature_type",
"post_vin_cutoff_name",
"display_order"
@ -19,13 +18,6 @@
"in_list_view": 1,
"label": "Content"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "feature_type",
"fieldtype": "Data",
@ -47,7 +39,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-18 15:58:40.444070",
"modified": "2023-09-01 14:53:19.397112",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Content",

12
smart_service/phase_2/doctype/feature_finder_disclaimer/feature_finder_disclaimer.json

@ -6,8 +6,7 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"content",
"active_status"
"content"
],
"fields": [
{
@ -15,19 +14,12 @@
"fieldtype": "Data",
"in_list_view": 1,
"label": "Content"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-07-21 15:51:05.822149",
"modified": "2023-09-01 15:53:09.133002",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Disclaimer",

10
smart_service/phase_2/doctype/feature_finder_images/feature_finder_images.json

@ -7,7 +7,6 @@
"engine": "InnoDB",
"field_order": [
"image",
"active_status",
"feature_type",
"post_vin_cutoff_name",
"display_order"
@ -19,13 +18,6 @@
"in_list_view": 1,
"label": "Image"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "feature_type",
"fieldtype": "Data",
@ -47,7 +39,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-08 10:43:06.101130",
"modified": "2023-09-01 14:52:57.774369",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Images",

12
smart_service/phase_2/doctype/feature_finder_master/feature_finder_master.js

@ -2,7 +2,13 @@
// For license information, please see license.txt
frappe.ui.form.on('Feature Finder Master', {
// refresh: function(frm) {
// }
refresh: function(frm) {
frm.set_query("feature_name", function() {
return {
"filters": {
"active_status": "Active",
}
};
});
}
});

11
smart_service/phase_2/doctype/feature_finder_publish_data/feature_finder_publish_data.json

@ -10,7 +10,6 @@
"variant",
"language",
"display_order",
"active_status",
"column_break_mmuuc",
"vehicle",
"feature_name",
@ -56,14 +55,6 @@
"read_only": 1,
"read_only_depends_on": "eval:doc.language!=\"en\""
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive",
"read_only": 1
},
{
"fieldname": "column_break_mmuuc",
"fieldtype": "Column Break"
@ -135,7 +126,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-28 11:26:13.293732",
"modified": "2023-09-01 15:49:01.572389",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Publish Data",

10
smart_service/phase_2/doctype/feature_finder_publish_docs/feature_finder_publish_docs.json

@ -10,7 +10,6 @@
"variant",
"language",
"display_order",
"active_status",
"feature_name",
"features_names",
"feature_category",
@ -43,13 +42,6 @@
"label": "Display Order",
"read_only_depends_on": "eval:doc.language!=\"en\""
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fetch_from": "variant.vehicle",
"fieldname": "vehicle",
@ -108,7 +100,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-28 11:23:50.811405",
"modified": "2023-09-01 15:49:27.435886",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Publish Docs",

10
smart_service/phase_2/doctype/feature_finder_specification/feature_finder_specification.json

@ -8,7 +8,6 @@
"field_order": [
"specification",
"value",
"active_status",
"feature_type",
"post_vin_cutoff_name",
"display_order"
@ -27,13 +26,6 @@
"in_list_view": 1,
"label": "Value"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "feature_type",
"fieldtype": "Data",
@ -54,7 +46,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-08 10:42:51.401310",
"modified": "2023-09-01 14:51:01.067448",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Feature Finder Specification",

12
smart_service/phase_2/doctype/mst_information_assets/mst_information_assets.json

@ -8,8 +8,7 @@
"field_order": [
"image",
"content",
"asset_type",
"active_status"
"asset_type"
],
"fields": [
{
@ -31,19 +30,12 @@
"label": "Asset Type",
"options": "Content\nImage\nVideo",
"set_only_once": 1
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-22 17:30:12.423559",
"modified": "2023-09-01 15:49:36.308339",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "MST Information Assets",

11
smart_service/phase_2/doctype/repair_check_publish_docs/repair_check_publish_docs.json

@ -9,7 +9,6 @@
"vehicle",
"check_list_name",
"language",
"active_status",
"parent_name",
"display_order",
"my_id",
@ -48,14 +47,6 @@
"options": "Repair Service Master",
"read_only": 1
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive",
"read_only": 1
},
{
"fieldname": "display_order",
"fieldtype": "Int",
@ -79,7 +70,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-22 11:37:24.248180",
"modified": "2023-09-01 15:50:08.162343",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Check Publish Docs",

10
smart_service/phase_2/doctype/repair_service_child/repair_service_child.json

@ -1,5 +1,4 @@
{
"_liked_by": "[\"Administrator\"]",
"actions": [],
"allow_rename": 1,
"creation": "2023-07-20 18:02:39.917427",
@ -8,17 +7,10 @@
"engine": "InnoDB",
"field_order": [
"complaint",
"active_status",
"remedial_action_ok",
"remedial_action_not_ok"
],
"fields": [
{
"fieldname": "active_status",
"fieldtype": "Select",
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "complaint",
"fieldtype": "Small Text",
@ -41,7 +33,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-04 09:54:39.573005",
"modified": "2023-09-01 15:50:17.434736",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Child",

11
smart_service/phase_2/doctype/repair_service_publish_data/repair_service_publish_data.json

@ -10,7 +10,6 @@
"parent_name",
"language",
"check_list_name",
"active_status",
"display_order",
"my_id",
"lang_myid"
@ -47,14 +46,6 @@
"options": "Repair Service Master",
"read_only": 1
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive",
"read_only": 1
},
{
"fieldname": "display_order",
"fieldtype": "Int",
@ -77,7 +68,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-17 10:40:27.362070",
"modified": "2023-09-01 15:49:45.988321",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Repair Service Publish Data",

13
smart_service/phase_2/doctype/training_information/training_information.json

@ -27,14 +27,16 @@
"fieldtype": "Link",
"in_list_view": 1,
"label": "Vehicle",
"options": "Vehicle"
"options": "Vehicle",
"set_only_once": 1
},
{
"fieldname": "category",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Category",
"options": "Training Information Master"
"options": "Training Information Master",
"set_only_once": 1
},
{
"fetch_from": "category.topic",
@ -45,8 +47,11 @@
{
"fieldname": "language",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Language",
"options": "Custom Languages"
"options": "Custom Languages",
"set_only_once": 1
},
{
"fieldname": "column_break_tweld",
@ -101,7 +106,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-22 11:44:03.286240",
"modified": "2023-09-01 16:20:55.674437",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Training Information",

10
smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json

@ -8,7 +8,6 @@
"field_order": [
"content_type",
"image_video",
"active_status",
"content"
],
"fields": [
@ -19,13 +18,6 @@
"label": "Content Type",
"options": "Heading\nContent\nImage\nVideo"
},
{
"fieldname": "active_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Active Status",
"options": "Active\nInactive"
},
{
"fieldname": "content",
"fieldtype": "Data",
@ -42,7 +34,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-10 13:19:37.649272",
"modified": "2023-09-01 15:50:27.467100",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Training Information Content Reference",

98
smart_service/transactions/doctype/publish/publish.py

@ -584,11 +584,6 @@ def get_service_repair(vehicle,
''', as_dict=1)
return data
def create_df(data_set):
# with open(base_url+'data.json', 'w') as outfile:
# outfile.write(json.dumps(feature_finder_tmp, indent=4, default=str))
# with open(base_url+'data.json') as f:
# feature_finder_tmp = json.load(f)
feature_finder_tmp=json.dumps(data_set)
df = pd.DataFrame(json.loads(feature_finder_tmp))
filter_group=df.groupby('variant')
@ -720,13 +715,14 @@ def feature_finder_publish(vehicle=None, vehicle_id=None,
create_publish_folders(folder_url)
file_path = folder_url + "/" + publish_type + "/" + \
vehicle.replace(' ', '-') + '-feature_finder' + '.json'
global_file_path=folder_url + "/" + "Global" + "/" + \
vehicle.replace(' ', '-') + '-feature_finder' + '.json'
'''Append Published Data to Json'''
logger.info(
f'Repair Checksheet Data Append Start::{vehicle}-{language}-{publish_type}')
'''update existing global json file'''
if os.path.isfile(file_path):
with open(file_path) as f:
if os.path.isfile(file_path) and publish_type == 'Internal':
with open(global_file_path) as f:
published_data = json.load(f)
for i in parent:
feature_finder = feature_finder_data(vehicle, language,
@ -736,14 +732,21 @@ def feature_finder_publish(vehicle=None, vehicle_id=None,
feature_finder_tmp.append(
feature_finder['data'][0])
feature_finder_tmp=create_df(feature_finder_tmp)
# frappe.msgprint(str(json.dumps(feature_finder_tmp)))
# feature_finder_tmp = get_latest_data(
# {'data': published_data['data']}, {'data': feature_finder_tmp})
vehi_data = compare_get_data( {'data': published_data['data']}, {'data': feature_finder_tmp})
elif os.path.isfile(file_path) and publish_type == 'Global':
with open(global_file_path) as f:
published_data = json.load(f)
for i in parent:
feature_finder = feature_finder_data(vehicle, language,
publish_type, i.parent1, i.variant)
if feature_finder['status'] == 1:
publish_repair_checksheet = 1
feature_finder_tmp.append(
feature_finder['data'][0])
feature_finder_tmp=create_df(feature_finder_tmp)
vehi_data = compare_get_data( {'data': published_data['data']}, {'data': feature_finder_tmp})
else:
for i in parent:
feature_finder = feature_finder_data(
vehicle, language, publish_type, i.parent1, i.variant)
@ -760,9 +763,8 @@ def feature_finder_publish(vehicle=None, vehicle_id=None,
{'data': feature_finder_tmp}, {'data': []})
vehi_data=create_df(feature_finder_tmp)
# if publish_feature_finder == 1:
""" Save publish file """
""" Save publish file """
vehicle_data['data'] = vehi_data
with open(file_path, 'w') as outfile:
outfile.write(json.dumps(vehicle_data, indent=4, default=str))
@ -808,24 +810,65 @@ def get_latest_data(prev_data, latest_data):
def compare_get_data(prev_data, latest_data):
try:
logger_file = 'compare'
logger = frappe.logger(logger_file,
allow_site=True, file_count=100)
logger.info(
f"start compare data")
final_dic={}
for key,value in prev_data.items():
prev_data[key]=latest_data.get(key)
final_dic=copy.deepcopy(prev_data)
final_dic=prev_data.copy()
for key,value in final_dic["data"].items():
for i in value:
if i['active_status']=="Inactive":
value.remove(i)
for key,value in latest_data["data"].items():
for i in value:
if i['active_status']=="Inactive":
value.remove(i)
#compare old & new json
for key,values in latest_data["data"].items():
for i in latest_data["data"][key]:
check_key({key:i},final_dic["data"],'')
logger.info(
f"End of compare data"+str(final_dic['data']))
return final_dic["data"]
return final_dic['data']
except Exception as e:
logger.error(str(e))
frappe.throw(str(e))
def check_key(key_name, old_data, type=None):
try:
frappe.msgprint(str(key_name))
logger_file = 'check key'
logger = frappe.logger(logger_file,
allow_site=True, file_count=100)
logger.info(
f"start of key data")
new_dict=[]
for key,val in key_name.items():
if key in old_data:
if val['name'] in old_data:
for old_key,old_val in old_data.items():
for i in old_val:
if val['name'] in old_val :
if old_key == key and val['name'] == i['name']:
i.update(val)
else:
old_data[key].append(val)
else:
new_dict.append(val)
old_data[key]=new_dict
logger.info(f"end of key data"+str(key_name))
except Exception as e:
logger.error(str(e))
return str(e)
def repair_checksheet_data(vehicle=None, language=None,
publish_type=None, parent=None):
try:
@ -845,8 +888,7 @@ def repair_checksheet_data(vehicle=None, language=None,
for d in repair_service_details:
d['complaint'] = frappe.db.sql(f"""select complaint,remedial_action_ok,
remedial_action_not_ok,idx as display_order,
active_status from `tabRepair Service Child`
remedial_action_not_ok,idx as display_order from `tabRepair Service Child`
where parent = '{d['name']}'
order by display_order ;""", as_dict=1)
@ -893,17 +935,17 @@ def feature_finder_data(vehicle=None, language=None,
for f in feature_finder_details:
f['disclaimer'] = frappe.db.sql(f'''
SELECT name,content,active_status,idx as display_order FROM `tabFeature Finder Disclaimer`
SELECT name,content,idx as display_order FROM `tabFeature Finder Disclaimer`
where parent = '{str(f['vehicle'])+ str('-')+ str(f['feature_name']) +str('-')+str(f['language'])}';
''', as_dict=1)
sop_images = frappe.db.sql(f""" select image,display_order,active_status from `tabFeature Finder Images` where
sop_images = frappe.db.sql(f""" select image,display_order from `tabFeature Finder Images` where
parent = '{f['name']}' and feature_type ='SOP' order by display_order desc;""", as_dict=1)
sop_content = frappe.db.sql(f"""select content,display_order, active_status from `tabFeature Finder Content`
sop_content = frappe.db.sql(f"""select content,display_order from `tabFeature Finder Content`
where parent = '{f['name']}' and feature_type ='SOP' order by display_order desc;""", as_dict=1)
sop_specification = frappe.db.sql(f"""select specification,value,display_order,active_status from `tabFeature Finder Specification`
sop_specification = frappe.db.sql(f"""select specification,value,display_order from `tabFeature Finder Specification`
where parent = '{f['name']}' and feature_type ='SOP' order by display_order desc;""", as_dict=1)
f['sop'] = {'content': sop_content, 'images': sop_images,
@ -912,13 +954,13 @@ def feature_finder_data(vehicle=None, language=None,
from `tabPost Vin Cutoff ID` where parent = '{f['name']}';''', as_dict=1)
for p in post_vin_data:
vin_content = frappe.db.sql(f"""select content,display_order, active_status from `tabFeature Finder Content`
vin_content = frappe.db.sql(f"""select content,display_order from `tabFeature Finder Content`
where parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}' order by display_order desc;""", as_dict=1)
vin_images = frappe.db.sql(f""" select image,display_order,active_status from `tabFeature Finder Images` where
vin_images = frappe.db.sql(f""" select image,display_order from `tabFeature Finder Images` where
parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}' order by display_order desc;""", as_dict=1)
vin_specification = frappe.db.sql(f"""select specification,value,display_order,active_status from `tabFeature Finder Specification`
vin_specification = frappe.db.sql(f"""select specification,value,display_order from `tabFeature Finder Specification`
where parent = '{f['name']}' and post_vin_cutoff_name ='{p['post_vin_cutoff_name']}' order by display_order desc;""", as_dict=1)
p['content'] = vin_content
p['images'] = vin_images

Loading…
Cancel
Save