fix: make rename_doc work pre_model_sync (#26419)
This commit is contained in:
parent
35f0d92e40
commit
da740081c6
1 changed files with 12 additions and 10 deletions
|
|
@ -451,27 +451,29 @@ def get_link_fields(doctype: str) -> list[dict]:
|
|||
frappe.flags.link_fields = {}
|
||||
|
||||
if doctype not in frappe.flags.link_fields:
|
||||
virtual_doctypes = frappe.get_all("DocType", {"is_virtual": 1}, pluck="name")
|
||||
|
||||
dt = frappe.qb.DocType("DocType")
|
||||
df = frappe.qb.DocType("DocField")
|
||||
cf = frappe.qb.DocType("Custom Field")
|
||||
ps = frappe.qb.DocType("Property Setter")
|
||||
|
||||
standard_fields = (
|
||||
standard_fields_query = (
|
||||
frappe.qb.from_(df)
|
||||
.inner_join(dt)
|
||||
.on(df.parent == dt.name)
|
||||
.select(df.parent, df.fieldname, dt.issingle.as_("issingle"))
|
||||
.where(
|
||||
(df.options == doctype)
|
||||
& (df.fieldtype == "Link")
|
||||
& (df.is_virtual == 0)
|
||||
& (dt.is_virtual == 0)
|
||||
)
|
||||
.run(as_dict=True)
|
||||
.where((df.options == doctype) & (df.fieldtype == "Link"))
|
||||
)
|
||||
|
||||
if frappe.db.has_column("DocField", "is_virtual"):
|
||||
standard_fields_query = standard_fields_query.where(df.is_virtual == 0)
|
||||
|
||||
virtual_doctypes = []
|
||||
if frappe.db.has_column("DocType", "is_virtual"):
|
||||
virtual_doctypes = frappe.get_all("DocType", {"is_virtual": 1}, pluck="name")
|
||||
standard_fields_query = standard_fields_query.where(dt.is_virtual == 0)
|
||||
|
||||
standard_fields = standard_fields_query.run(as_dict=True)
|
||||
|
||||
cf_issingle = frappe.qb.from_(dt).select(dt.issingle).where(dt.name == cf.dt).as_("issingle")
|
||||
custom_fields = (
|
||||
frappe.qb.from_(cf)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue