mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-15 04:45:09 +00:00
This commit is contained in:
@@ -8,6 +8,7 @@ import frappe
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt, formatdate
|
from frappe.utils import flt, formatdate
|
||||||
|
|
||||||
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_dimensions
|
||||||
from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
|
from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
|
||||||
|
|
||||||
|
|
||||||
@@ -15,6 +16,8 @@ def execute(filters=None):
|
|||||||
if not filters:
|
if not filters:
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
|
validate_filters(filters)
|
||||||
|
|
||||||
columns = get_columns(filters)
|
columns = get_columns(filters)
|
||||||
if filters.get("budget_against_filter"):
|
if filters.get("budget_against_filter"):
|
||||||
dimensions = filters.get("budget_against_filter")
|
dimensions = filters.get("budget_against_filter")
|
||||||
@@ -35,6 +38,21 @@ def execute(filters=None):
|
|||||||
return columns, data, None, chart
|
return columns, data, None, chart
|
||||||
|
|
||||||
|
|
||||||
|
def validate_filters(filters):
|
||||||
|
validate_budget_dimensions(filters)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_budget_dimensions(filters):
|
||||||
|
dimensions = [d.get("document_type") for d in get_dimensions(with_cost_center_and_project=True)[0]]
|
||||||
|
if filters.get("budget_against") and filters.get("budget_against") not in dimensions:
|
||||||
|
frappe.throw(
|
||||||
|
title=_("Invalid Accounting Dimension"),
|
||||||
|
msg=_("{0} is not a valid Accounting Dimension.").format(
|
||||||
|
frappe.bold(filters.get("budget_against"))
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation):
|
def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation):
|
||||||
for account, monthwise_data in dimension_items.items():
|
for account, monthwise_data in dimension_items.items():
|
||||||
row = [dimension, account]
|
row = [dimension, account]
|
||||||
|
|||||||
Reference in New Issue
Block a user