fix: exception on register reports when filtered on cost center
1
This commit is contained in:
committed by
ruthra kumar
parent
a671fe13d4
commit
f01e1a8e20
@@ -255,7 +255,9 @@ def get_journal_entries(filters, args):
|
|||||||
)
|
)
|
||||||
.orderby(je.posting_date, je.name, order=Order.desc)
|
.orderby(je.posting_date, je.name, order=Order.desc)
|
||||||
)
|
)
|
||||||
query = apply_common_conditions(filters, query, doctype="Journal Entry", payments=True)
|
query = apply_common_conditions(
|
||||||
|
filters, query, doctype="Journal Entry", child_doctype="Journal Entry Account", payments=True
|
||||||
|
)
|
||||||
|
|
||||||
journal_entries = query.run(as_dict=True)
|
journal_entries = query.run(as_dict=True)
|
||||||
return journal_entries
|
return journal_entries
|
||||||
@@ -306,7 +308,9 @@ def apply_common_conditions(filters, query, doctype, child_doctype=None, payment
|
|||||||
query = query.where(parent_doc.posting_date <= filters.to_date)
|
query = query.where(parent_doc.posting_date <= filters.to_date)
|
||||||
|
|
||||||
if payments:
|
if payments:
|
||||||
if filters.get("cost_center"):
|
if doctype == "Journal Entry" and filters.get("cost_center"):
|
||||||
|
query = query.where(child_doc.cost_center == filters.cost_center)
|
||||||
|
elif filters.get("cost_center"):
|
||||||
query = query.where(parent_doc.cost_center == filters.cost_center)
|
query = query.where(parent_doc.cost_center == filters.cost_center)
|
||||||
else:
|
else:
|
||||||
if filters.get("cost_center"):
|
if filters.get("cost_center"):
|
||||||
|
|||||||
Reference in New Issue
Block a user