Fixes in general ledger report

This commit is contained in:
Nabin Hait 2013-12-24 11:58:05 +05:30
parent a3d058938e
commit 6a2edee914
2 changed files with 9 additions and 7 deletions
accounts/report/general_ledger
setup/doctype/features_setup

@ -9,8 +9,9 @@ from accounts.utils import get_balance_on
def execute(filters=None):
account_details = webnotes.conn.get_value("Account", filters["account"],
["debit_or_credit", "group_or_ledger"], as_dict=True)
validate_filters(filters, account_details.group_or_ledger)
["debit_or_credit", "group_or_ledger"], as_dict=True) if filters.get("account") else None
validate_filters(filters, account_details)
columns = get_columns()
data = []
if filters.get("group_by"):
@ -20,14 +21,15 @@ def execute(filters=None):
if data:
data.append(get_total_row(data))
if filters.get("account"):
if account_details:
data = [get_opening_balance_row(filters, account_details.debit_or_credit)] + data + \
[get_closing_balance_row(filters, account_details.debit_or_credit)]
return columns, data
def validate_filters(filters, group_or_ledger):
if group_or_ledger == "Ledger" and filters.get("group_by") == "Group by Account":
def validate_filters(filters, account_details):
if account_details and account_details.group_or_ledger == "Ledger" \
and filters.get("group_by") == "Group by Account":
webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
if filters.get("voucher_no") and filters.get("group_by") == "Group by Voucher":

@ -2,7 +2,7 @@
{
"creation": "2012-12-20 12:50:49",
"docstatus": 0,
"modified": "2013-11-03 14:20:18",
"modified": "2013-12-24 11:40:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -90,7 +90,7 @@
"doctype": "DocField",
"fieldname": "fs_packing_details",
"fieldtype": "Check",
"label": "Packing Detials"
"label": "Packing Details"
},
{
"description": "To get Item Group in details table",