Browse Source

role master,publish hide update button

version2
venkata akhil 8 months ago
parent
commit
a751202101
  1. 8
      smart_service/apis/utils.py
  2. 3
      smart_service/apis/v2/master.py
  3. 5
      smart_service/masters/doctype/role_master/role_master.json
  4. 25
      smart_service/phase_2/doctype/torque_manual/torque_manual.js
  5. 4
      smart_service/phase_2/doctype/torque_manual/torque_manual.json
  6. 25
      smart_service/phase_2/doctype/training_information/training_information.js
  7. 15
      smart_service/phase_2/doctype/training_information/training_information.py
  8. 6
      smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json
  9. 2
      smart_service/transactions/doctype/publish/publish.py

8
smart_service/apis/utils.py

@ -78,10 +78,16 @@ def check_ppt_ext(path):
return True
elif ext.lower().endswith('.ppt'):
return True
else:
return False
@frappe.whitelist()
def check_web_link(path):
if path.lower().startswith("http:") or path.lower().startswith("https:"):
return True
else:
return False
def details_of_image(image_file):
try:
# Image dimension validation

3
smart_service/apis/v2/master.py

@ -746,3 +746,6 @@ def get_published_data():
data = frappe.db.sql("""select vehicle,variant,language,publish_type from `tabPublish` where not in (select vehicle,variant,language,publish_type from
`tabModule Publish Mapping`)""", as_dict=1)
return data

5
smart_service/masters/doctype/role_master/role_master.json

@ -33,7 +33,8 @@
{
"fieldname": "module_master_html",
"fieldtype": "HTML",
"label": "Module Master"
"label": "Module Master",
"read_only": 1
},
{
"fieldname": "module_name_configuration",
@ -67,7 +68,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-11-30 10:57:17.784350",
"modified": "2024-01-09 18:00:03.439171",
"modified_by": "Administrator",
"module": "Masters",
"name": "Role Master",

25
smart_service/phase_2/doctype/torque_manual/torque_manual.js

@ -12,13 +12,15 @@ frappe.require('assets/smart_service/css/boostrap_table.css', () => {
frappe.ui.form.on('Torque Manual', {
refresh: function(frm) {
set_display_order(frm)
if (frm.doc.vehicle){
get_column_data(frm)
// if (frm.doc.vehicle){
// get_column_data(frm)
}
// }
},
onload:function(frm){
if (frm.doc.vehicle){
@ -69,9 +71,20 @@ function get_column_data(frm){
}).done((r) => {
let details = []
if(r.message.success == 1){
if(r.message.data.length>0){
cur_frm.set_df_property('column_details','hidden',0)
cur_frm.refresh_field('column_details')
cur_frm.set_df_property('torque_table','hidden',0)
cur_frm.refresh_field('torque_table')
}
else{
cur_frm.set_df_property('column_details','hidden',1)
cur_frm.refresh_field('column_details')
cur_frm.set_df_property('torque_table','hidden',1)
cur_frm.refresh_field('torque_table')
frappe.throw("Create Column For Selected Vehicle in"+"<b>"+"Torque Manual Mapping Doctype"+"</b>")
}
$.each(r.message.data, function(_i, e){
details.push({"columnid":e.column_id,"column_name":e.column_name});
selected_columns_for_grid.push({"fieldname":e.column_id,"columns":1 })

4
smart_service/phase_2/doctype/torque_manual/torque_manual.json

@ -111,12 +111,14 @@
{
"fieldname": "torque_table",
"fieldtype": "Table",
"hidden": 1,
"label": "Torque Table",
"options": "Torque Manual Details"
},
{
"fieldname": "column_details",
"fieldtype": "HTML",
"hidden": 1,
"label": "Column Details",
"read_only": 1
},
@ -127,7 +129,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-12-21 11:12:41.126313",
"modified": "2024-01-09 16:04:49.178650",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Torque Manual",

25
smart_service/phase_2/doctype/training_information/training_information.js

@ -41,7 +41,7 @@ frappe.ui.form.on('Training Information', {
}
})
}
if (frm.doc.content) {
frappe.call({
method: "smart_service.phase_2.doctype.training_information.training_information.file_validation_child",
@ -50,7 +50,7 @@ frappe.ui.form.on('Training Information', {
value:"file_url"
},
callback: function (r) {
console.log(r.message, "----file validation size-------")
debugger
if (r.message && r.message[0] == false) {
if (r.message[1]) {
frappe.validated = false;
@ -95,13 +95,34 @@ frappe.ui.form.on('Training Information Content Reference',{
cur_frm.get_field("content").grid.grid_rows[x].columns.index_file_name.df.reqd = 1;
cur_frm.refresh_fields("content")
}
else if(select_value.topic == 'Web Links'){
cur_frm.get_field("content").grid.grid_rows[x].columns.file_name.df.reqd = 0;
cur_frm.refresh_fields("content")
cur_frm.refresh_field();
}
else {
cur_frm.get_field("content").grid.grid_rows[x].columns.index_file_name.df.reqd = 0;
cur_frm.refresh_fields("content")
}
// if (select_value.topic == 'Web Links'){
// console.log("hiii")
// cur_frm.get_field("file_name").grid.grid_rows[x].columns.index_file_name.df.reqd = 0;
// cur_frm.refresh_fields("file_name")
// cur_frm.refresh_field();
// }
cur_frm.refresh_field("content");
cur_frm.refresh_field();
},
// file_name:function(frm,cdt,cdn){
// var x = locals[cdt][cdn];
// if(x.file_name.length>100){
// frappe.throw("File name should be under 100 characters")
// cur_frm.refresh_field();
// }
// frappe.validated = false;
// // cur_frm.refresh_field("file_name");
// },
// validate:function(frm){

15
smart_service/phase_2/doctype/training_information/training_information.py

@ -6,7 +6,7 @@ from frappe.model.document import Document
from frappe.utils import cstr
import zipfile
import os
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,check_ppt_ext,get_file_size,check_html_ext
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,check_ppt_ext,get_file_size,check_html_ext,check_ppt_ext,check_web_link
site_name = cstr(frappe.local.site)
BASE_URL = os.path.expanduser(
@ -32,6 +32,12 @@ class TrainingInformation(Document):
self.my_id = 1
if not self.is_new() and self.is_published == 1:
self.is_published = 0
if self.content:
for d in self.content:
if len(d.file_name)>100:
frappe.throw("<b>"+str(d.topic)+ ":"+"</b>"+"File Name should not exceed more than 100 characters")
except Exception as e:
raise e
@ -164,11 +170,13 @@ def file_validation_child(name, value=None):
if name:
child_data = frappe.db.sql(
"""select * from `tabTraining Information Content Reference` where parent='%s';""" % (name), as_dict=1)
frappe.log_error(str(child_data))
for d in child_data:
if d['topic'] and d['file_url']:
if d['topic']:
res = False
res1 = False
if d['topic'] =="PDF":
frappe.log_error(str(d['topic']))
res = check_pdf_ext(d['file_url'])
if d['topic'] =="PPT":
@ -186,6 +194,9 @@ def file_validation_child(name, value=None):
if d['topic'] == "HTML":
res = check_zip_ext(d['file_url'])
if d['topic'] == "Web Links":
break
if res==True or res1==True:
valuess,idx = get_file_details(d['topic'],d['file_url'],value,name,1,d['idx'],d['name'])

6
smart_service/phase_2/doctype/training_information_content_reference/training_information_content_reference.json

@ -31,10 +31,10 @@
},
{
"fieldname": "file_name",
"fieldtype": "Data",
"fieldtype": "Text",
"in_list_view": 1,
"label": "File Name",
"reqd": 1
"mandatory_depends_on": "eval:doc.topic!='Web Links';"
},
{
"fieldname": "file_url",
@ -59,7 +59,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-12-21 10:38:23.351587",
"modified": "2024-01-08 16:57:46.089923",
"modified_by": "Administrator",
"module": "Phase-2",
"name": "Training Information Content Reference",

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

@ -417,8 +417,6 @@ def cal_ver(vehicle, lang, publish_type, doc, publish_module):
""" Create global publish document for publish ready procedures """
@frappe.whitelist()
def global_publish(doc):
doc = frappe.get_doc("Publish", doc)

Loading…
Cancel
Save