Skip to content

Commit

Permalink
fix(UX): Make fetch_from read_only if fetch_is_empty is not set (#19025)
Browse files Browse the repository at this point in the history
* fix(UX): Make fetch_from read_only if fetch_is_empty is not set

* Update frappe/public/js/frappe/form/controls/base_input.js

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit abb9055)
  • Loading branch information
shariquerik authored and mergify[bot] committed Nov 29, 2022
1 parent 476dda3 commit 0102b53
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion frappe/public/js/frappe/form/controls/base_input.js
Expand Up @@ -80,7 +80,9 @@ frappe.ui.form.ControlInput = frappe.ui.form.Control.extend({
me.value = me.doc[me.df.fieldname];
}

if (me.can_write()) {
let is_fetch_from_read_only = me.df.fetch_from && !me.df.fetch_if_empty;

if (me.can_write() && !is_fetch_from_read_only) {
me.disp_area && $(me.disp_area).toggle(false);
$(me.input_area).toggle(true);
me.$input && me.$input.prop("disabled", false);
Expand All @@ -98,6 +100,16 @@ frappe.ui.form.ControlInput = frappe.ui.form.Control.extend({
}
}
me.$input && me.$input.prop("disabled", true);

if (is_fetch_from_read_only) {
$(me.disp_area).attr(
"title",
__(
"This value is fetched from {0}'s {1} field",
me.df.fetch_from.split(".")
)
);
}
}

me.set_description();
Expand Down

0 comments on commit 0102b53

Please sign in to comment.