Merge remote-tracking branch 'upstream/master' into develop

Conflicts:
	erpnext/accounts/report/general_ledger/general_ledger.py
This commit is contained in:
Anand Doshi 2015-09-30 17:13:58 +05:30
commit 15d2c89939

View File

@ -157,6 +157,7 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
if filters.get("account") or filters.get("party"):
data += [get_balance_row(_("Opening"), opening, opening_in_account_currency), {}]
if filters.get("group_by_account"):
for acc, acc_dict in gle_map.items():
if acc_dict.entries:
# Opening for individual ledger, if grouped by account
@ -177,6 +178,24 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
get_balance_row(_("Closing (Opening + Totals)"),
account_closing, account_closing_in_account_currency), {}]
else:
from_date, to_date = getdate(filters.from_date), getdate(filters.to_date)
opening_debit = opening_credit = 0.0
for gl in gl_entries:
if gl.posting_date < from_date:
opening_debit += flt(gl.debit, 3)
opening_credit += flt(gl.credit, 3)
else:
data.append(gl)
if not (filters.get("account") or filters.get("party")):
data = [{
"account": "'" + _("Opening") + "'",
"debit": opening_debit,
"credit": opening_credit
}] + data
# Total debit and credit between from and to date
if total_debit or total_credit:
data.append({