Skip to content

Commit 6292ba9

Browse files
committed
fix: reload Diagnostic Report after workflow action to resolve unsaved state
1 parent b1c908b commit 6292ba9

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

healthcare/healthcare/doctype/diagnostic_report/diagnostic_report.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ frappe.ui.form.on("Diagnostic Report", {
1212
},
1313
before_save: function (frm) {
1414
if (!frm.is_new() && frm.is_dirty()) {
15-
this.diagnostic_report.save_action("save");
15+
return this.diagnostic_report.save_action("save");
1616
}
1717
},
1818
after_workflow_action: function (frm) {
@@ -21,6 +21,9 @@ frappe.ui.form.on("Diagnostic Report", {
2121
args: {
2222
docname: frm.doc.name,
2323
},
24+
callback: function () {
25+
frm.reload_doc();
26+
},
2427
});
2528
},
2629
});
@@ -89,18 +92,18 @@ var generate_pdf_with_print_format = function (frm) {
8992

9093
const w = window.open(
9194
"/api/method/frappe.utils.print_format.download_multi_pdf?" +
92-
"doctype=" +
93-
encodeURIComponent(frm.doc.doctype) +
94-
"&name=" +
95-
encodeURIComponent(doc_names) +
96-
"&format=" +
97-
encodeURIComponent(print_format) +
98-
"&no_letterhead=" +
99-
(with_letterhead ? "0" : "1") +
100-
"&letterhead=" +
101-
encodeURIComponent(letterhead) +
102-
"&options=" +
103-
encodeURIComponent(pdf_options),
95+
"doctype=" +
96+
encodeURIComponent(frm.doc.doctype) +
97+
"&name=" +
98+
encodeURIComponent(doc_names) +
99+
"&format=" +
100+
encodeURIComponent(print_format) +
101+
"&no_letterhead=" +
102+
(with_letterhead ? "0" : "1") +
103+
"&letterhead=" +
104+
encodeURIComponent(letterhead) +
105+
"&options=" +
106+
encodeURIComponent(pdf_options),
104107
);
105108

106109
if (!w) {

healthcare/public/js/diagnostic_report_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ healthcare.Diagnostic.DiagnosticReport = class DiagnosticReport {
6969
save_action(func) {
7070
var me = this;
7171
if (func == "save") {
72-
frappe.call({
72+
return frappe.call({
7373
method: "healthcare.healthcare.doctype.observation.observation.record_observation_result",
7474
args: {
7575
values: this.result,

healthcare/public/js/observation_widget.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,11 @@ healthcare.ObservationWidget = class {
207207
options: options,
208208
read_only: 1 ? obs_data.status == "Approved" : 0,
209209
change: s => {
210-
me.frm.dirty();
211-
me.set_result_n_name(obs_data.name);
210+
let current_val = me[obs_data.name].get_value("result");
211+
if ((current_val || "") != (default_input || "")) {
212+
me.frm.dirty();
213+
me.set_result_n_name(obs_data.name);
214+
}
212215
},
213216
default: default_input,
214217
hidden: 1 ? obs_data.observation_category == "Imaging" : 0,

0 commit comments

Comments
 (0)