fix: add permission conditions to where clause instead of join
This commit is contained in:
parent
27f104bba6
commit
9a774de21e
1 changed files with 2 additions and 4 deletions
|
|
@ -1833,13 +1833,11 @@ class LinkTableField(DynamicTableField):
|
|||
table = frappe.qb.DocType(self.doctype)
|
||||
main_table = frappe.qb.DocType(self.parent_doctype)
|
||||
if not query.is_joined(table):
|
||||
clause = table.name == getattr(main_table, self.link_fieldname)
|
||||
|
||||
query = query.left_join(table).on(table.name == getattr(main_table, self.link_fieldname))
|
||||
if engine and engine.apply_permissions:
|
||||
if condition := engine.get_permission_conditions(self.doctype, table):
|
||||
clause &= condition
|
||||
query = query.where(condition)
|
||||
|
||||
query = query.left_join(table).on(clause)
|
||||
return query
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue