mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
fix: SQL ssyntax error
This commit is contained in:
@@ -153,15 +153,19 @@ def get_conditions(filters):
|
|||||||
accounting_dimensions = get_accounting_dimensions(as_list=False)
|
accounting_dimensions = get_accounting_dimensions(as_list=False)
|
||||||
|
|
||||||
if accounting_dimensions:
|
if accounting_dimensions:
|
||||||
|
common_condition = """
|
||||||
|
and exists(select name from `tabPurchase Invoice Item`
|
||||||
|
where parent=`tabPurchase Invoice`.name
|
||||||
|
"""
|
||||||
for dimension in accounting_dimensions:
|
for dimension in accounting_dimensions:
|
||||||
if filters.get(dimension.fieldname):
|
if filters.get(dimension.fieldname):
|
||||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||||
filters.get(dimension.fieldname))
|
filters.get(dimension.fieldname))
|
||||||
|
|
||||||
conditions += """ and exists(select name from `tabPurchase Invoice Item`
|
conditions += common_condition + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname)
|
||||||
where parent=`tabPurchase Invoice`.name
|
else:
|
||||||
and ifnull(`tabPurchase Invoice Item`.{0}, '') in %({0})s)""".format(dimension.fieldname)
|
conditions += common_condition + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in (%({0})s))".format(dimension.fieldname)
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user