Merge pull request #19586 from ruchamahabal/fix-fetch-if-empty

This commit is contained in:
Shariq Ansari 2023-01-16 10:26:42 +05:30 committed by GitHub
commit cd8049e569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,7 +213,12 @@ frappe.ui.form.ScriptManager = class ScriptManager {
df.read_only == 1 ||
df.is_virtual == 1;
if (is_read_only_field && df.fetch_from && df.fetch_from.indexOf(".") != -1) {
if (
is_read_only_field &&
df.fetch_from &&
(!df.fetch_if_empty || (df.fetch_if_empty && !me.frm.doc[df.fieldname])) &&
df.fetch_from.indexOf(".") != -1
) {
var parts = df.fetch_from.split(".");
me.frm.add_fetch(parts[0], parts[1], df.fieldname, df.parent);
}