Not saved status displayed in the doc when there is virtual field on refresh. How to fix it?

Screenshot from 2024-03-26 11-40-52

here employee name is virtual field.
When refreshed, i got not saved status.

here is the code
f

rappe.ui.form.on("Logi360 Employee and Branch", {
	refresh(frm) {
        updateName(frm);
	},
    employee_id(frm) {
        updateName(frm)
    },
 
});

function updateName(frm) {
    if (frm.doc.employee_id) {
        frappe.call({
            method: "frappe.client.get",
            args: {
                doctype: "User",
                name: frm.doc.employee_id
            },
            callback: function (data) {
                if (data.message) {
                    //frm.fields_dict.employee_name.set_value(data.message.full_name);
                    frm.set_value("employee_name", data.message.full_name);
                }
            }
        });
    }
}

hi @Prasant_Pant maybe instead of using set_value on js.
Use python function to achieve, so there will be no “Not Saved”.

Here some reference
https://frappeframework.com/docs/user/en/basics/virtual_docfield

1 Like