Browse Source

http path get from py file

master
venkataakhil 1 year ago
parent
commit
d654f47b19
  1. 16
      smart_service/transactions/doctype/procedure/procedure.js
  2. 5
      smart_service/transactions/doctype/procedure/procedure.py

16
smart_service/transactions/doctype/procedure/procedure.js

@ -69,21 +69,29 @@ frappe.ui.form.on('Procedure', {
callback: function (r) {
}
})
if(frm.doc.procedure_details){
frappe.call({
"method": "smart_service.transactions.doctype.procedure.procedure.get_path",
"args": {
"name": frm.doc.name,
},
callback: function (r) {
var url = window.location.host;
var regex = /[://]+/;
// frappe.db.get_value('Fish', { name: "Fish" }, 'path', (r) => {
frappe.db.get_single_value("Fish", "path").then((r) => {
for (var i = 0; i < frm.doc.procedure_details.length; i++) {
if (frm.doc.procedure_details[i].content && r.path && frm.doc.procedure_details[i].content_type == "Link"){// && !(frm.doc.procedure_details[i].content).includes('</a>')){
var x = "<a href=" + '"' + r.path + "://" + url + "/app/procedure/" + frm.doc.procedure_details[i].temp_cnt+ '"' + 'target="_blank"' + ' role="link"' +' onclick="window.open('+r.path + "://" + url + "/app/procedure/" + frm.doc.procedure_details[i].temp_cnt+')"'+'>' + frm.doc.procedure_details[i].temp_cnt + '</a>';
if (frm.doc.procedure_details[i].content && r.message && frm.doc.procedure_details[i].content_type == "Link"){// && !(frm.doc.procedure_details[i].content).includes('</a>')){
var x = "<a href=" + '"' + r.message + "://" + url + "/app/procedure/" + frm.doc.procedure_details[i].temp_cnt+ '"' + 'target="_blank"' + ' role="link"' +' onclick="window.open('+r.message + "://" + url + "/app/procedure/" + frm.doc.procedure_details[i].temp_cnt+')"'+'>' + frm.doc.procedure_details[i].temp_cnt + '</a>';
frm.doc.procedure_details[i].content = x
}
}
cur_frm.refresh_fields('procedure_details');
// })
}
})
}
}
select_row(frm);
if (frm.doc.procedure_filter == "All") {
frm.get_field('procedure_details').grid.static_rows = false;

5
smart_service/transactions/doctype/procedure/procedure.py

@ -245,3 +245,8 @@ def update_system_id(name):
frappe.db.sql("""update {0}.`tabProcedure_Details` set system_id = '{1}' where parent = '{2}' and temp_cnt = '{3}'""".format(
current_db_name, sys_id, doc.name, table.temp_cnt))
frappe.db.commit()
@frappe.whitelist()
def get_path(name):
path = frappe.db.get_single_value("Fish", "path")
if path:
return path
Loading…
Cancel
Save