Browse Source

double extension,url path for procedure link

master
Ubuntu 2 years ago
parent
commit
32e49731be
  1. 12
      smart_service/overrides/overrides/override_file.py
  2. 11
      smart_service/transactions/doctype/fish/fish.json
  3. 11
      smart_service/transactions/doctype/procedure/procedure.js

12
smart_service/overrides/overrides/override_file.py

@ -3,8 +3,10 @@ import frappe, json
import json
from frappe.utils import cstr, flt, cint
def validate(doc=None,method=None):
f = doc.file_name
file_split = f.split('.')
file_length = len(file_split)
if file_length > 2:
frappe.throw("Double Extension file not allowed")
data = ['.jpg', '.png','.mp4', '.docx','.xls', '.pdf','.tiff','.ppt','.m4v','.doc','.pps','.pptx']
file_name = doc.file_name
total_count = 0
for i in data:
total_count += file_name.count(i)
if total_count > 1:
frappe.throw('Double Extension file not allowed')

11
smart_service/transactions/doctype/fish/fish.json

@ -6,19 +6,26 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"apple"
"apple",
"path"
],
"fields": [
{
"fieldname": "apple",
"fieldtype": "Data",
"label": "Apple"
},
{
"fieldname": "path",
"fieldtype": "Select",
"label": "Path",
"options": "https\nhttp"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2022-02-12 13:41:59.230075",
"modified": "2022-05-27 13:46:42.150311",
"modified_by": "Administrator",
"module": "Transactions",
"name": "Fish",

11
smart_service/transactions/doctype/procedure/procedure.js

@ -18,6 +18,17 @@ cur_frm.fields_dict['procedure_details'].grid.get_field('step_name').get_query =
frappe.ui.form.on('Procedure', {
onload: function (frm) {
if(frm.doc.procedure_details){
var url = window.location.host;
frappe.db.get_value('Fish', {name: "Fish"}, 'path' , (r) =>{
for (var i=0;i<frm.doc.procedure_details.length;i++){
if(frm.doc.procedure_details[i].content && r.path){
var x = "<a href=" + '"' + r.path + "://" + url + "/app/procedure/" + frm.doc.procedure_details[i].content
frm.doc.procedure_details[i].content = x + '"' + 'target="_blank"' + '>' + frm.doc.procedure_details[i].content + '</a>';
}
}
})
}
if (frm.doc.workflow_state == 'Publish Ready'){
frm.set_read_only();
}

Loading…
Cancel
Save