8000 fix: only make fetch_from field read only if no input (backport #19192) by mergify[bot] · Pull Request #19195 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: only make fetch_from field read only if no input (backport #19192) #19195

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
Dec 8, 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
10 changes: 9 additions & 1 deletion frappe/public/js/frappe/form/controls/base_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
}
}

read_only_because_of_fetch_from() {
return (
this.df.fetch_from &&
!this.df.fetch_if_empty &&
this.frm?.doc?.[this.df.fetch_from.split(".")[0]]
);
}

// update input value, label, description
// display (show/hide/read-only),
// mandatory style on refresh
Expand Down Expand Up @@ -82,7 +90,7 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
me.value = me.doc[me.df.fieldname] || "";
}

let is_fetch_from_read_only = me.df.fetch_from && !me.df.fetch_if_empty;
let is_fetch_from_read_only = me.read_only_because_of_fetch_from();

if (me.can_write() && !is_fetch_from_read_only) {
me.disp_area && $(me.disp_area).toggle(false);
Expand Down
0