Browse Source

MST release

version2
venkata akhil 12 months ago
parent
commit
95bf6d9a58
  1. 10
      smart_service/apis/v2/master.py
  2. 4
      smart_service/masters/doctype/app_labels/app_labels.js
  3. 4
      smart_service/masters/doctype/app_labels/app_labels.json
  4. 12
      smart_service/phase_2/doctype/instructions/instructions.json
  5. 5
      smart_service/phase_2/doctype/qwik_service/qwik_service.json
  6. 1
      smart_service/phase_2/doctype/repair_service_master/repair_service_master.js
  7. 76
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.js
  8. 17
      smart_service/phase_2/doctype/special_tool_information/special_tool_information.json
  9. 2
      smart_service/transactions/doctype/publish/publish.py

10
smart_service/apis/v2/master.py

@ -1,5 +1,5 @@
import frappe
import re
from urllib import request
import datetime
from frappe import utils
@ -171,6 +171,13 @@ def new_publish():
elif module == 'QWIK Service':
flag, data = get_qwik_service(variant, language)
CLEANR = re.compile('<.*?>')
for dt in data:
if dt['consumables']:
for con in dt['consumables']:
con['content'] = re.sub(CLEANR, '', con['content'])
elif module == 'Training Information':
# flag, data = get_training_information(vehicle, language)
@ -190,6 +197,7 @@ def new_publish():
data = 'No Module found'
if flag:
frappe.log_error(str(data))
return {'status': 1, 'error': None, 'data': data}
else:
return {'status': 0, 'error': data, 'data': None}

4
smart_service/masters/doctype/app_labels/app_labels.js

@ -1,6 +1,6 @@
// Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
// For license information, please see license.txt
var regex = /[!@#$%^&*()]+/;
var regex = /[!@#$%^&]+/;
frappe.ui.form.on('App Labels', {
is_group: function (frm) {
@ -41,7 +41,9 @@ frappe.ui.form.on('App Labels', {
}
// var regex = /[!@#$%^&*()+\=\[\]{};`~'"\\|.<>\/]+/;
if (frm.doc.english_label) {
console.log(regex.test(frm.doc.english_label))
if (regex.test(frm.doc.english_label) === true) {
debugger
frappe.throw(__("<b>English Label :</b> Only letters, numbers and <b> - , </b> are allowed."));
frappe.validated = false;
} else if (frm.doc.english_label) {

4
smart_service/masters/doctype/app_labels/app_labels.json

@ -34,7 +34,7 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Translated Label",
"reqd": 1
"mandatory_depends_on": "eval:doc.language!=\"en\";"
},
{
"fieldname": "english_label",
@ -95,7 +95,7 @@
"index_web_pages_for_search": 1,
"is_tree": 1,
"links": [],
"modified": "2022-01-04 14:37:33.603797",
"modified": "2023-10-13 15:05:41.477964",
"modified_by": "Administrator",
"module": "Masters",
"name": "App Labels",

12
smart_service/phase_2/doctype/instructions/instructions.json

@ -25,23 +25,19 @@
"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
"read_only_depends_on": "// eval:doc.content_type == 'PDF'"
},
{
"fieldname": "content",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Content",
"read_only_depends_on": "// eval:doc.content_type=='Image'"
"label": "Content"
},
{
"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';"
"label": "Attach File"
},
{
"fieldname": "title",
@ -53,7 +49,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-05 17:29:43.636314",
"modified": "2023-10-11 10:23:12.256705",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Instructions",

5
smart_service/phase_2/doctype/qwik_service/qwik_service.json

@ -118,7 +118,8 @@
"description": "Upload *.pdf 1 MB",
"fieldname": "pdf",
"fieldtype": "Attach",
"label": "PDF"
"label": "PDF",
"reqd": 1
},
{
"fieldname": "tab_ref",
@ -144,7 +145,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-06 12:00:17.840332",
"modified": "2023-10-13 11:25:55.189777",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Qwik Service",

1
smart_service/phase_2/doctype/repair_service_master/repair_service_master.js

@ -2,6 +2,7 @@
// For license information, please see license.txt
var original_display_order = 0;
var vehicle_count=0;
// frappe.require('assets/smart_service/js/utils.js', () => {})
frappe.ui.form.on('Repair Service Master', {

76
smart_service/phase_2/doctype/special_tool_information/special_tool_information.js

@ -76,9 +76,9 @@ frappe.ui.form.on('Special Tool Information', {
value: "image"
},
callback: function (r) {
console.log(r.message, "r.message")
// console.log(r.message, "r.message")
if (r.message && r.message[0] == false) {
frm.doc.upload_file = ""
frm.doc.image = ""
frm.refresh_fields("image")
if (r.message[1] == 1) {
frappe.validated = false;
@ -101,9 +101,9 @@ frappe.ui.form.on('Special Tool Information', {
value: "aggregate_image"
},
callback: function (r) {
console.log(r.message, "r.message")
// console.log(r.message, "r.message")
if (r.message && r.message[0] == false) {
frm.doc.upload_file = ""
frm.doc.aggregate_image = ""
frm.refresh_fields("aggregate_image")
if (r.message[1] == 1) {
frappe.validated = false;
@ -125,13 +125,19 @@ frappe.ui.form.on('Special Tool Information', {
// name:frm.doc.name
},
callback: function (r) {
console.log(r.message, "r.message")
// console.log(r.message, "r.message")
if (r.message && r.message[0] == false) {
frm.doc.pdf = ""
frm.refresh_fields("pdf")
if (r.message[1] == 1) {
frappe.validated = false;
frappe.msgprint("Invalid file type")
frm.reload_doc()
}
if (r.message[1] == 2) {
frappe.validated = false;
frappe.msgprint("Invalid file size")
}
}
@ -146,11 +152,18 @@ frappe.ui.form.on('Special Tool Information', {
name:frm.doc.name
},
callback: function (r) {
console.log(r.message, "r.message")
// console.log(r.message, "r.message")
if (r.message && r.message[0] == false) {
frm.doc.video = ""
frm.refresh_fields("video")
if (r.message[1] == 1) {
frappe.validated = false;
frappe.msgprint("Invalid file type")
frm.reload_doc()
}
if (r.message[1] == 2) {
frappe.validated = false;
frappe.msgprint("Invalid file size")
}
}
@ -168,25 +181,25 @@ frappe.ui.form.on('Special Tool Information', {
if (!frm.is_new()){
teb_validation(frm)
}
if (frm.doc.instructions) {
frappe.call({
method: "smart_service.phase_2.doctype.special_tool_information.special_tool_information.file_validation_child",
args: {
name: frm.doc.name,
value:"instructions"
},
callback: function (r) {
console.log(r.message, "----file validation size-------")
if (r.message && r.message[0] == false) {
if (r.message[1]) {
frappe.validated = false;
frm.reload_doc()
frappe.throw("In Special Tool information content " + r.message[1] + " row was invalid file type")
}
}
}
})
}
// if (frm.doc.instructions) {
// frappe.call({
// method: "smart_service.phase_2.doctype.special_tool_information.special_tool_information.file_validation_child",
// args: {
// name: frm.doc.name,
// value:"instructions"
// },
// callback: function (r) {
// console.log(r.message, "----file validation size-------")
// if (r.message && r.message[0] == false) {
// if (r.message[1]) {
// frappe.validated = false;
// frm.reload_doc()
// frappe.throw("In Special Tool information content " + r.message[1] + " row was invalid file type")
// }
// }
// }
// })
// }
},
});
function teb_validation(frm){
@ -200,13 +213,6 @@ function teb_validation(frm){
// frm.reload_doc()
if(frm.doc.category == "TEB"){
//to nullify the table
if (frm.doc.instructions && frm.doc.instructions.length > 0) {
cur_frm.clear_table("instructions");
cur_frm.refresh_fields('instructions');
cur_frm.refresh_fields();
}
//to set df property to child readonly based on main doc
cur_frm.refresh_fields("instructions");
var df = frappe.meta.get_docfield("Instructions", "content", cur_frm.doc.name);
@ -282,6 +288,7 @@ frappe.ui.form.on('Instructions', {
refresh_field("instructions");
},
content_type: function (frm, cdt, cdn) {
cur_frm.refresh_field("content_type")
var select_value = locals[cdt][cdn];
var x = select_value.idx - 1;
if (select_value.content_type == 'Image' || select_value.content_type == 'Video' || select_value.content_type == 'PDF'){
@ -296,11 +303,12 @@ frappe.ui.form.on('Instructions', {
cur_frm.get_field("instructions").grid.grid_rows[x].columns.content.df.read_only = 0;
cur_frm.get_field("instructions").grid.grid_rows[x].columns.step_name.df.read_only = 0;
cur_frm.get_field("instructions").grid.grid_rows[x].columns.title.df.read_only = 0;
cur_frm.refresh_fields("content_type")
cur_frm.refresh_field("content_type")
}
frm.reload_doc()
// frm.reload_doc()
cur_frm.refresh_fields("content_type")
refresh_field("instructions");
cur_frm.refresh_fields();
},
})
function check_field_character(field_name) {

17
smart_service/phase_2/doctype/special_tool_information/special_tool_information.json

@ -106,7 +106,7 @@
"in_standard_filter": 1,
"label": "Category",
"options": "Maintenance Service Category (MS)\nRepair Service Category (RS)\nOverhaul Service Category (OS)\nTEB",
"set_only_once": 1
"reqd": 1
},
{
"depends_on": "eval:doc.category !='TEB';",
@ -135,19 +135,23 @@
"in_standard_filter": 1,
"label": "Tool Type",
"options": "New Tool\nCarry Over",
"reqd": 1,
"set_only_once": 1
},
{
"depends_on": "eval:doc.category!=\"TEB\";",
"description": "Upload *.png(1920x1080 pixel) 1 MB",
"fieldname": "image",
"fieldtype": "Attach Image",
"label": "Image"
"label": "Image",
"reqd": 1
},
{
"fieldname": "column_break_m3p9i",
"fieldtype": "Column Break"
},
{
"depends_on": "eval:doc.category!=\"TEB\";",
"description": "Upload *.mp4 max 100 MB",
"fieldname": "video",
"fieldtype": "Attach",
@ -158,7 +162,7 @@
"fieldtype": "Column Break"
},
{
"depends_on": "eval:doc.image;",
"depends_on": "eval:doc.image && doc.category!=\"TEB\";;",
"fieldname": "image_preview",
"fieldtype": "Image",
"label": "Image Preview",
@ -170,11 +174,10 @@
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Tool Name",
"reqd": 1
"label": "Tool Name"
},
{
"depends_on": "eval:doc.aggregate_image;",
"depends_on": "eval:doc.aggregate_image && doc.category!=\"TEB\";;",
"fieldname": "aggregate_image_preview",
"fieldtype": "Image",
"label": "Aggregate Image Preview",
@ -183,7 +186,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-09 13:48:14.303807",
"modified": "2023-10-13 17:10:45.217112",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Special Tool Information",

2
smart_service/transactions/doctype/publish/publish.py

@ -234,7 +234,7 @@ def update_publish_mapping(vehicle, variant, language, module, publish_type):
elif module == 'Feature Finder':
doc.feature_finder = 1
elif module == 'QWIK Service'
doc.save()

Loading…
Cancel
Save