From 284af156e07b4fda0129097222d089a0a7d43bc9 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:17:14 +0200 Subject: [PATCH] fix: refresh fields after `frm.set_read_only` (#26998) --- frappe/public/js/frappe/form/form.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index 7edf8544cc57..bd74ee5bd147 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -418,7 +418,7 @@ frappe.ui.form.Form = class FrappeForm { // read only (workflow) this.read_only = frappe.workflow.is_read_only(this.doctype, this.docname); if (this.read_only) { - this.set_read_only(true); + this.set_read_only(); frappe.show_alert(__("This form is not editable due to a Workflow.")); } @@ -671,6 +671,10 @@ frappe.ui.form.Form = class FrappeForm { } refresh_fields() { + if (this.layout === undefined) { + return; + } + this.layout.refresh(this.doc); this.layout.primary_button = this.$wrapper.find(".btn-primary"); @@ -1843,6 +1847,7 @@ frappe.ui.form.Form = class FrappeForm { email: p.email, }; }); + this.refresh_fields(); } trigger(event, doctype, docname) {