From a948726dddea7f2e3d2ee91910deb7065dee69e0 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:16:57 +0530 Subject: [PATCH 01/11] Added Finance Book doctype --- .../accounts/doctype/finance_book/__init__.py | 0 .../doctype/finance_book/finance_book.js | 8 + .../doctype/finance_book/finance_book.json | 165 ++++++++++++++++++ .../doctype/finance_book/finance_book.py | 10 ++ .../doctype/finance_book/test_finance_book.js | 23 +++ .../doctype/finance_book/test_finance_book.py | 10 ++ 6 files changed, 216 insertions(+) create mode 100644 erpnext/accounts/doctype/finance_book/__init__.py create mode 100644 erpnext/accounts/doctype/finance_book/finance_book.js create mode 100644 erpnext/accounts/doctype/finance_book/finance_book.json create mode 100644 erpnext/accounts/doctype/finance_book/finance_book.py create mode 100644 erpnext/accounts/doctype/finance_book/test_finance_book.js create mode 100644 erpnext/accounts/doctype/finance_book/test_finance_book.py diff --git a/erpnext/accounts/doctype/finance_book/__init__.py b/erpnext/accounts/doctype/finance_book/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/finance_book/finance_book.js b/erpnext/accounts/doctype/finance_book/finance_book.js new file mode 100644 index 0000000000..71191bb0cf --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/finance_book.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Finance Book', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/accounts/doctype/finance_book/finance_book.json b/erpnext/accounts/doctype/finance_book/finance_book.json new file mode 100644 index 0000000000..d13a484028 --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/finance_book.json @@ -0,0 +1,165 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "field:finance_book_name", + "beta": 0, + "creation": "2018-04-13 17:42:43.252224", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "finance_book_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-book", + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-04-23 02:15:07.997774", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Finance Book", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 0 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Auditor", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 0 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "finance_book_name", + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 1 +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/finance_book/finance_book.py b/erpnext/accounts/doctype/finance_book/finance_book.py new file mode 100644 index 0000000000..bc9fce2ce8 --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/finance_book.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FinanceBook(Document): + pass diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.js b/erpnext/accounts/doctype/finance_book/test_finance_book.js new file mode 100644 index 0000000000..9fb7d4fcc8 --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Finance Book", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Finance Book + () => frappe.tests.make('Finance Book', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py new file mode 100644 index 0000000000..771e8130c5 --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestFinanceBook(unittest.TestCase): + pass From 30f9e0f54732d217670337c44369eb80134f1f19 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:17:42 +0530 Subject: [PATCH 02/11] Set finance book in make_gl_entries --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index f9ffbcdbd7..51308e5008 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -460,7 +460,8 @@ class JournalEntry(AccountsController): "against_voucher": d.reference_name, "remarks": self.remark, "cost_center": d.cost_center, - "project": d.project + "project": d.project, + "finance_book": self.finance_book }) ) From a6d3cbfbc51f6f66452910a6a44c806f5651b049 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:19:14 +0530 Subject: [PATCH 03/11] Added finance book field to GL Entry doctype --- .../accounts/doctype/gl_entry/gl_entry.json | 61 +++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json index 441266199a..4b3396828b 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.json +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json @@ -41,6 +41,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -72,6 +73,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -104,6 +106,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -134,6 +137,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -164,6 +168,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -196,6 +201,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -229,6 +235,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -262,6 +269,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -293,6 +301,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -324,6 +333,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -355,6 +365,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -386,6 +397,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -418,6 +430,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -450,6 +463,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -482,6 +496,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -514,6 +529,7 @@ "reqd": 0, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -545,6 +561,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -576,6 +593,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -608,6 +626,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -640,6 +659,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -672,6 +692,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -704,6 +725,39 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "finance_book", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Finance Book", + "length": 0, + "no_copy": 0, + "options": "Finance Book", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -718,7 +772,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-20 12:40:09.611951", + "modified": "2018-04-23 02:15:22.297509", "modified_by": "Administrator", "module": "Accounts", "name": "GL Entry", @@ -726,7 +780,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -746,7 +799,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -766,7 +818,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -794,4 +845,4 @@ "sort_order": "DESC", "track_changes": 0, "track_seen": 0 -} +} \ No newline at end of file From 460d96f16d3557ce501789e226ba1fefb3ce1718 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:29:22 +0530 Subject: [PATCH 04/11] Added finance book filter to General Ledger --- .../report/general_ledger/general_ledger.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index 5e8f9cfc28..91879a8c1f 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -11,6 +11,20 @@ frappe.query_reports["General Ledger"] = { "default": frappe.defaults.get_user_default("Company"), "reqd": 1 }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + "get_query": function() { + var company = frappe.query_report_filters_by_name.company.get_value(); + return { + "filters": { + "company": company, + } + }; + } + }, { "fieldname":"from_date", "label": __("From Date"), From 57856b475c6c9ba12dfb578f53976167f3372910 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:29:48 +0530 Subject: [PATCH 05/11] Added finance book filter logic in general_ledger.py --- erpnext/accounts/report/general_ledger/general_ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 7fd653e39b..6c16a840a0 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -164,6 +164,11 @@ def get_conditions(filters): if filters.get("project"): conditions.append("project=%(project)s") + if filters.get("finance_book"): + conditions.append("finance_book=%(finance_book)s") + else: + conditions.append("ifnull(finance_book, '')=''") + from frappe.desk.reportview import build_match_conditions match_conditions = build_match_conditions("GL Entry") From cddda8ac5fc8f5cd7aa23b8fc0ae867daa25bff3 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:49:30 +0530 Subject: [PATCH 06/11] Added finance book filter in accounts_payable.js --- .../report/accounts_payable/accounts_payable.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index 63ef83263c..cd6a8fc5f8 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -10,6 +10,20 @@ frappe.query_reports["Accounts Payable"] = { "options": "Company", "default": frappe.defaults.get_user_default("Company") }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + "get_query": function() { + var company = frappe.query_report_filters_by_name.company.get_value(); + return { + "filters": { + "company": company, + } + }; + } + }, { "fieldname":"supplier", "label": __("Supplier"), From 70ac2d2c51e5598fce968d18ef8e780c212c899a Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:56:50 +0530 Subject: [PATCH 07/11] Added finance book filter in accounts_receivable.js --- .../accounts_receivable/accounts_receivable.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index ec1e9f9d61..776835e86d 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -10,6 +10,20 @@ frappe.query_reports["Accounts Receivable"] = { "options": "Company", "default": frappe.defaults.get_user_default("Company") }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + "get_query": function() { + var company = frappe.query_report_filters_by_name.company.get_value(); + return { + "filters": { + "company": company, + } + }; + } + }, { "fieldname":"customer", "label": __("Customer"), From 40559d5f5cabe904df830384ea4f3d29fe008985 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 02:57:10 +0530 Subject: [PATCH 08/11] Added finance book filter logic to ReceivablePayable --- .../report/accounts_receivable/accounts_receivable.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 61096837f5..eb14513d79 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -321,6 +321,13 @@ class ReceivablePayableReport(object): conditions.append("company=%s") values.append(self.filters.company) + if self.filters.finance_book: + conditions.append("finance_book=%s") + values.append(self.filters.finance_book) + else: + conditions.append("ifnull(finance_book,'')=%s") + values.append('') + if self.filters.get(party_type_field): conditions.append("party=%s") values.append(self.filters.get(party_type_field)) From 8cbbdfdf309b3c31ed57062fad0c5acfef33773e Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 03:36:02 +0530 Subject: [PATCH 09/11] Added finance book filter to financial_statements.js --- erpnext/public/js/financial_statements.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js index 29e3999f0a..94518f83da 100644 --- a/erpnext/public/js/financial_statements.js +++ b/erpnext/public/js/financial_statements.js @@ -70,6 +70,20 @@ function get_filters(){ "default": frappe.defaults.get_user_default("Company"), "reqd": 1 }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + "get_query": function() { + var company = frappe.query_report_filters_by_name.company.get_value(); + return { + "filters": { + "company": company, + } + }; + } + }, { "fieldname":"from_fiscal_year", "label": __("Start Year"), From a78a0e241fb6e02089d7708d5477e20148eb0725 Mon Sep 17 00:00:00 2001 From: Gaurav Naik Date: Mon, 23 Apr 2018 04:10:01 +0530 Subject: [PATCH 10/11] Added finance book filtering logic to financial_statements.py --- erpnext/accounts/report/financial_statements.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index dd47ca0b37..87b7ba1536 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -375,6 +375,11 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters): additional_conditions.append("project = '%s'" % (frappe.db.escape(filters.get("project")))) if filters.get("cost_center"): additional_conditions.append(get_cost_center_cond(filters.get("cost_center"))) + if filters.get("finance_book"): + additional_conditions.append("finance_book = '%s'" % frappe.db.escape(filters.get("finance_book"))) + else: + additional_conditions.append("ifnull(finance_book, '') = ''") + return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else "" From b9fed2aa38c322354999f4d828eec0e40193a0e3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 9 May 2018 15:10:29 +0530 Subject: [PATCH 11/11] Removed company from Finance Book and related changes --- .../doctype/finance_book/finance_book.json | 34 +------------------ .../doctype/journal_entry/journal_entry.json | 34 ++++++++++++++++++- .../accounts_payable/accounts_payable.js | 10 +----- .../accounts_receivable.js | 10 +----- .../accounts_receivable.py | 2 +- .../accounts/report/financial_statements.py | 3 +- .../report/general_ledger/general_ledger.js | 10 +----- .../report/general_ledger/general_ledger.py | 2 +- erpnext/public/js/financial_statements.js | 10 +----- 9 files changed, 42 insertions(+), 73 deletions(-) diff --git a/erpnext/accounts/doctype/finance_book/finance_book.json b/erpnext/accounts/doctype/finance_book/finance_book.json index d13a484028..c9fb843cc3 100644 --- a/erpnext/accounts/doctype/finance_book/finance_book.json +++ b/erpnext/accounts/doctype/finance_book/finance_book.json @@ -43,38 +43,6 @@ "set_only_once": 0, "translatable": 0, "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 } ], "has_web_view": 0, @@ -88,7 +56,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-23 02:15:07.997774", + "modified": "2018-05-09 14:55:01.394387", "modified_by": "Administrator", "module": "Accounts", "name": "Finance Book", diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 916c71f20f..a975aa0756 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -238,6 +238,38 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "finance_book", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Finance Book", + "length": 0, + "no_copy": 0, + "options": "Finance Book", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1553,7 +1585,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2018-05-05 13:11:33.696498", + "modified": "2018-05-09 14:56:08.687994", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry", diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index cd6a8fc5f8..f39df3da3d 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -14,15 +14,7 @@ frappe.query_reports["Accounts Payable"] = { "fieldname":"finance_book", "label": __("Finance Book"), "fieldtype": "Link", - "options": "Finance Book", - "get_query": function() { - var company = frappe.query_report_filters_by_name.company.get_value(); - return { - "filters": { - "company": company, - } - }; - } + "options": "Finance Book" }, { "fieldname":"supplier", diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index 776835e86d..2caf3590fb 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -14,15 +14,7 @@ frappe.query_reports["Accounts Receivable"] = { "fieldname":"finance_book", "label": __("Finance Book"), "fieldtype": "Link", - "options": "Finance Book", - "get_query": function() { - var company = frappe.query_report_filters_by_name.company.get_value(); - return { - "filters": { - "company": company, - } - }; - } + "options": "Finance Book" }, { "fieldname":"customer", diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index eb14513d79..fc76be406e 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -322,7 +322,7 @@ class ReceivablePayableReport(object): values.append(self.filters.company) if self.filters.finance_book: - conditions.append("finance_book=%s") + conditions.append("finance_book in (%s, '')") values.append(self.filters.finance_book) else: conditions.append("ifnull(finance_book,'')=%s") diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 87b7ba1536..ea22bacf21 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -376,7 +376,8 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters): if filters.get("cost_center"): additional_conditions.append(get_cost_center_cond(filters.get("cost_center"))) if filters.get("finance_book"): - additional_conditions.append("finance_book = '%s'" % frappe.db.escape(filters.get("finance_book"))) + additional_conditions.append("finance_book in ('%s', '')" % + frappe.db.escape(filters.get("finance_book"))) else: additional_conditions.append("ifnull(finance_book, '') = ''") diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index 91879a8c1f..9a774ce6b9 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -15,15 +15,7 @@ frappe.query_reports["General Ledger"] = { "fieldname":"finance_book", "label": __("Finance Book"), "fieldtype": "Link", - "options": "Finance Book", - "get_query": function() { - var company = frappe.query_report_filters_by_name.company.get_value(); - return { - "filters": { - "company": company, - } - }; - } + "options": "Finance Book" }, { "fieldname":"from_date", diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 6c16a840a0..2d0bd52fd0 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -165,7 +165,7 @@ def get_conditions(filters): conditions.append("project=%(project)s") if filters.get("finance_book"): - conditions.append("finance_book=%(finance_book)s") + conditions.append("finance_book in (%(finance_book)s, '')") else: conditions.append("ifnull(finance_book, '')=''") diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js index 94518f83da..7e31c573c5 100644 --- a/erpnext/public/js/financial_statements.js +++ b/erpnext/public/js/financial_statements.js @@ -74,15 +74,7 @@ function get_filters(){ "fieldname":"finance_book", "label": __("Finance Book"), "fieldtype": "Link", - "options": "Finance Book", - "get_query": function() { - var company = frappe.query_report_filters_by_name.company.get_value(); - return { - "filters": { - "company": company, - } - }; - } + "options": "Finance Book" }, { "fieldname":"from_fiscal_year",