fix: dont rename link fields in Virtual doctypes

This commit is contained in:
ruthra kumar 2023-11-20 10:11:42 +05:30
parent ae9ae40bad
commit 94b2e509b9

View file

@ -464,11 +464,12 @@ def get_link_fields(doctype: str) -> list[dict]:
cf = frappe.qb.DocType("Custom Field")
ps = frappe.qb.DocType("Property Setter")
st_issingle = frappe.qb.from_(dt).select(dt.issingle).where(dt.name == df.parent).as_("issingle")
standard_fields = (
frappe.qb.from_(df)
.select(df.parent, df.fieldname, st_issingle)
.where((df.options == doctype) & (df.fieldtype == "Link"))
.inner_join(dt)
.on(df.parent == dt.name)
.select(df.parent, df.fieldname, dt.issingle.as_("issingle"))
.where((df.options == doctype) & (df.fieldtype == "Link") & (dt.is_virtual == 0))
.run(as_dict=True)
)