Serial Number doctype showing Not saved after click on save

Hi ,

I wrote custom script for serial no doctype to fetch the file url of attached files to serial No doctype.I created custom field in serial No doctype with Long text datatype and i used some html code and inserted the pdf icon with href to that file link.After attaching the pdf to serial no doctype on refresh i am fetching the url and making that custom field as read only.But on click of save is it storing in database.But it showing Not saved status in UI.Please suggest me how to fix this issue.

This is code i have wrote
frappe.ui.form.on(“Serial No”, “refresh”, function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
var attached_to_name =;
console.log(“attached_to_name”, attached_to_name);
var attached_to_doctype = d.doctype;
console.log(“attached_to_doctype”, attached_to_doctype);

var file_url_pressure_test = fetch_file_url_pressure(attached_to_name);
console.log("file_url_pressure_test", file_url_pressure_test);
var file_link1 = "<a href=" + file_url_pressure_test[0]['File_url'] + " " + "target='_blank'><img src='/files/pdf.jpg'  width='25' height='25'></a>"
cur_frm.set_value("pch1_pressure_test", file_link1.toString())

frm.set_df_property(“pch1_pressure_test”, “read_only”, frm.doc.__islocal ? 0 : 1);

function fetch_file_url_pressure(attached_to_name) {
console.log(“entered into fetch_file_url_pressure function”);
var pressure_test = “”;{
method: “nhance.api.get_file_url_pressure”,
args: {
“attached_to_name”: attached_to_name
async: false,
callback: function(r) {
if (r.message) {
pressure_test = r.message;

console.log("pressure_test", pressure_test);
return pressure_test


Thanks in advance,