mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix(report): Cost center filters in financial statements and general ledger
This commit is contained in:
@@ -8,7 +8,7 @@ from erpnext.accounts.report.utils import get_currency, convert_to_presentation_
|
||||
from frappe.utils import getdate, cstr, flt, fmt_money
|
||||
from frappe import _, _dict
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
|
||||
from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
@@ -155,9 +155,8 @@ def get_conditions(filters):
|
||||
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
|
||||
|
||||
if filters.get("cost_center"):
|
||||
lft, rgt = frappe.db.get_value("Cost Center", filters["cost_center"], ["lft", "rgt"])
|
||||
conditions.append("""cost_center in (select name from `tabCost Center`
|
||||
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
|
||||
filters.cost_center = get_cost_centers_with_children(filters.cost_center)
|
||||
conditions.append("cost_center in %(cost_center)s")
|
||||
|
||||
if filters.get("voucher_no"):
|
||||
conditions.append("voucher_no=%(voucher_no)s")
|
||||
@@ -179,9 +178,6 @@ def get_conditions(filters):
|
||||
if filters.get("project"):
|
||||
conditions.append("project in %(project)s")
|
||||
|
||||
if filters.get("cost_center"):
|
||||
conditions.append("cost_center in %(cost_center)s")
|
||||
|
||||
company_finance_book = erpnext.get_default_finance_book(filters.get("company"))
|
||||
if not filters.get("finance_book") or (filters.get("finance_book") == company_finance_book):
|
||||
filters['finance_book'] = company_finance_book
|
||||
|
||||
Reference in New Issue
Block a user