8000 fix(UX): Make fetch_from read_only if fetch_is_empty is not set (backport #19025) by mergify[bot] · Pull Request #19041 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(UX): Make fetch_from read_only if fetch_is_empty is not set (backport #19025) #19041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion frappe/public/js/frappe/form/controls/base_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
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 @@ -100,6 +102,16 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
}
}
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