From ddd9136d10c006ad8b596128bbe5844864ecd613 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 17 Jan 2019 17:53:58 +0530 Subject: [PATCH] Renamed field and added finance book column in the trial balance simple report --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 7 ------- erpnext/accounts/party.py | 2 +- erpnext/accounts/report/trial_balance/trial_balance.js | 4 ++-- erpnext/accounts/report/trial_balance/trial_balance.py | 7 ++++--- erpnext/accounts/report/trial_balance_simple/__init__.py | 0 .../report/trial_balance_simple/trial_balance_simple.json | 4 ++-- 6 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 erpnext/accounts/report/trial_balance_simple/__init__.py diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 15cc3fdbb9..30ae54b18b 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -30,13 +30,6 @@ frappe.ui.form.on('Payment Entry', { } } }); - frm.set_query("bank_account", function() { - return{ - "filters": { - "party": frm.doc.party, - } - } - }); frm.set_query("contact_person", function() { if (frm.doc.party) { return { diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index eb1146ba1a..acb5dd1c09 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -567,7 +567,7 @@ def get_partywise_advanced_payment_amount(party_type="Customer"): data = frappe.db.sql(""" SELECT party, sum({0}) as amount FROM `tabGL Entry` WHERE party_type = %s and against_voucher is null GROUP BY party""" - .format(("credit - debit") if party_type == "Customer" else "debit") , party_type, debug=1) + .format(("credit - debit") if party_type == "Customer" else "debit") , party_type) if data: return frappe._dict(data) \ No newline at end of file diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index 194f1bd497..cdc77456d0 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -83,8 +83,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "fieldtype": "Check" }, { - "fieldname": "include_non_finance_book_entries", - "label": __("Include Non Finance Book Entries"), + "fieldname": "include_default_book_entries", + "label": __("Include Default Book Entries"), "fieldtype": "Check" } ], diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 696e63bb2c..6b18c5d873 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -104,8 +104,8 @@ def get_rootwise_opening_balances(filters, report_type): if filters.finance_book: fb_conditions = " and finance_book = %(finance_book)s" - if filters.include_non_finance_book_entries: - fb_conditions = " and (finance_book = %(finance_book)s or finance_book is null)" + if filters.include_default_book_entries: + fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)s) or finance_book is null)" additional_conditions += fb_conditions @@ -124,7 +124,8 @@ def get_rootwise_opening_balances(filters, report_type): "from_date": filters.from_date, "report_type": report_type, "year_start_date": filters.year_start_date, - "finance_book": filters.finance_book + "finance_book": filters.finance_book, + "company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book') }, as_dict=True) diff --git a/erpnext/accounts/report/trial_balance_simple/__init__.py b/erpnext/accounts/report/trial_balance_simple/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json index ea5a97b106..fab3a76a0c 100644 --- a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json +++ b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json @@ -6,13 +6,13 @@ "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2018-11-22 17:40:11.317567", + "modified": "2019-01-17 17:20:42.374958", "modified_by": "Administrator", "module": "Accounts", "name": "Trial Balance (Simple)", "owner": "Administrator", "prepared_report": 0, - "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", + "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\",\n\tfinance_book as \"Finance Book:Link/Finance Book:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", "ref_doctype": "GL Entry", "report_name": "Trial Balance (Simple)", "report_type": "Query Report",