Say I have the following custom script:
frappe.call({
method: "app.app.doctype.sales_invoice.sales_invoice.onload",
args: {
self: frm.doc
},
freeze: true,
callback: function(r) {
if (r.message) {
cur_frm.doc = r.message;
}
}
});
the onload method returns the entire document. So essentially, r.message contains all the data of the Sales Invoice document after some manipulation. How can I get the data to be shown on the current form? I tried (as above) cur_frm.doc = r.message and even followed by refresh_fields but the form doesnt get updated. I understand probably set_value would work, but that would mean that I have to do it for every single field. Is there an easier way?
FYI the document is also local (i.e. never saved even once).