commit
5cce1e0929
@ -66,7 +66,7 @@ def get_gl_entries(filters):
|
|||||||
|
|
||||||
gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
|
gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
|
||||||
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
|
||||||
voucher_type, voucher_no, cost_center, remarks, against
|
voucher_type, voucher_no, cost_center, remarks, against, is_opening
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%(company)s {conditions}
|
where company=%(company)s {conditions}
|
||||||
{group_by_condition}
|
{group_by_condition}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cint, flt, getdate, formatdate
|
from frappe.utils import cint, flt, getdate, formatdate, cstr
|
||||||
from erpnext.accounts.report.financial_statements import filter_accounts, get_gl_entries
|
from erpnext.accounts.report.financial_statements import filter_accounts, get_gl_entries
|
||||||
|
|
||||||
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
|
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
|
||||||
@ -133,10 +133,7 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters)
|
|||||||
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
||||||
|
|
||||||
for entry in gl_entries_by_account.get(d.name, []):
|
for entry in gl_entries_by_account.get(d.name, []):
|
||||||
if entry.is_opening == "Yes" and d.root_type in ("Asset", "Liability", "Equity"):
|
if cstr(entry.is_opening) != "Yes":
|
||||||
d["opening_debit"] += flt(entry.debit)
|
|
||||||
d["opening_credit"] += flt(entry.credit)
|
|
||||||
else:
|
|
||||||
d["debit"] += flt(entry.debit)
|
d["debit"] += flt(entry.debit)
|
||||||
d["credit"] += flt(entry.credit)
|
d["credit"] += flt(entry.credit)
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,8 @@ def create_receivable_payable_account():
|
|||||||
|
|
||||||
account_id = account.name
|
account_id = account.name
|
||||||
|
|
||||||
frappe.db.set_value("Company", args["company"], ("default_receivable_account"
|
frappe.db.set_value("Company", args["company"], ("default_receivable_account"
|
||||||
if args["account_type"]=="Receivable" else "default_payable_account"), account_id)
|
if args["account_type"]=="Receivable" else "default_payable_account"), account_id)
|
||||||
|
|
||||||
receivable_payable_accounts.setdefault(args["company"], {}).setdefault(args["account_type"], account_id)
|
receivable_payable_accounts.setdefault(args["company"], {}).setdefault(args["account_type"], account_id)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user