From 30fda3ee5465a9862686c33e5c3140a28974e2db Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 9 Apr 2019 18:46:40 +0530 Subject: [PATCH] feat: Added bank account no in bank reconcilliation --- .../bank_reconciliation.json | 141 +++++++++++++++++- .../bank_reconciliation.py | 15 +- .../doctype/journal_entry/journal_entry.js | 6 +- .../journal_entry_account.json | 66 +++++++- 4 files changed, 212 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json index 3ab73b717d..e2f967dacc 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json @@ -1,5 +1,6 @@ { "allow_copy": 1, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, @@ -13,11 +14,14 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "description": "Select account head of the bank where cheque was deposited.", + "fetch_from": "bank_account_no.account", + "fetch_if_empty": 1, "fieldname": "bank_account", "fieldtype": "Link", "hidden": 0, @@ -40,14 +44,17 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "account_currency", "fieldtype": "Link", "hidden": 1, @@ -70,14 +77,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "from_date", "fieldtype": "Date", "hidden": 0, @@ -99,14 +109,17 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "to_date", "fieldtype": "Date", "hidden": 0, @@ -128,14 +141,83 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "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, + "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_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bank_account_no", + "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": "Bank Account No", + "length": 0, + "no_copy": 0, + "options": "Bank Account", + "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_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "include_reconciled_entries", "fieldtype": "Check", "hidden": 0, @@ -157,14 +239,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "include_pos_transactions", "fieldtype": "Check", "hidden": 0, @@ -187,14 +272,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "get_payment_entries", "fieldtype": "Button", "hidden": 0, @@ -217,14 +305,49 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { - "allow_bulk_edit": 1, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, + "fieldname": "section_break_10", + "fieldtype": "Section Break", + "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, + "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": 1, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "payment_entries", "fieldtype": "Table", "hidden": 0, @@ -247,14 +370,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "update_clearance_date", "fieldtype": "Button", "hidden": 0, @@ -277,14 +403,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_amount", "fieldtype": "Currency", "hidden": 0, @@ -307,22 +436,21 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], "has_web_view": 0, - "hide_heading": 1, "hide_toolbar": 1, "icon": "fa fa-check", "idx": 1, - "image_view": 0, "in_create": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2018-03-07 18:58:48.658687", + "modified": "2019-04-09 18:41:06.110453", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Reconciliation", @@ -330,7 +458,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 0, @@ -351,9 +478,9 @@ ], "quick_entry": 1, "read_only": 1, - "read_only_onload": 0, "show_name_in_global_search": 0, "sort_order": "ASC", "track_changes": 0, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index fae5213f23..28807c4118 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -19,8 +19,11 @@ class BankReconciliation(Document): condition = "" if not self.include_reconciled_entries: - condition = "and (clearance_date is null or clearance_date='0000-00-00')" + condition = " and (clearance_date is null or clearance_date='0000-00-00')" + account_cond = "" + if self.bank_account_no: + account_cond = " and t2.bank_account_no = {0}".format(frappe.db.escape(self.bank_account_no)) journal_entries = frappe.db.sql(""" select @@ -33,10 +36,13 @@ class BankReconciliation(Document): where t2.parent = t1.name and t2.account = %s and t1.docstatus=1 and t1.posting_date >= %s and t1.posting_date <= %s - and ifnull(t1.is_opening, 'No') = 'No' {0} + and ifnull(t1.is_opening, 'No') = 'No' {0} {1} group by t2.account, t1.name order by t1.posting_date ASC, t1.name DESC - """.format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1) + """.format(condition, account_cond), (self.bank_account, self.from_date, self.to_date), as_dict=1) + + if self.bank_account_no: + condition = " and bank_account = %(bank_account_no)s" payment_entries = frappe.db.sql(""" select @@ -53,7 +59,8 @@ class BankReconciliation(Document): order by posting_date ASC, name DESC """.format(condition), - {"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1) + {"account":self.bank_account, "from":self.from_date, + "to":self.to_date, "bank_account_no": self.bank_account_no}, as_dict=1) pos_entries = [] if self.include_pos_transactions: diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index d0aa62eb8f..3ac677e50a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -6,6 +6,10 @@ frappe.provide("erpnext.journal_entry"); frappe.ui.form.on("Journal Entry", { + setup: function(frm) { + frm.add_fetch("bank_account_no", "account", "account"); + }, + refresh: function(frm) { erpnext.toggle_naming_series(); frm.cscript.voucher_type(frm.doc); @@ -234,7 +238,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ out.filters.push([jvd.reference_type, "per_billed", "<", 100]); } - + if(jvd.party_type && jvd.party) { var party_field = ""; if(jvd.reference_type.indexOf("Sales")===0) { diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json index 32e49dbde4..6aa37d8c10 100644 --- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json +++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json @@ -21,6 +21,7 @@ "bold": 1, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "account", "fieldtype": "Link", "hidden": 0, @@ -57,6 +58,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "account_type", "fieldtype": "Data", "hidden": 1, @@ -89,6 +91,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "balance", "fieldtype": "Currency", "hidden": 0, @@ -125,6 +128,7 @@ "columns": 0, "default": ":Company", "description": "If Income or Expense", + "fetch_if_empty": 0, "fieldname": "cost_center", "fieldtype": "Link", "hidden": 0, @@ -161,6 +165,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break1", "fieldtype": "Column Break", "hidden": 0, @@ -191,6 +196,41 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, + "fieldname": "bank_account_no", + "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": "Bank Account No", + "length": 0, + "no_copy": 0, + "options": "Bank Account", + "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_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "party_type", "fieldtype": "Link", "hidden": 0, @@ -223,6 +263,7 @@ "bold": 0, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "party", "fieldtype": "Dynamic Link", "hidden": 0, @@ -255,6 +296,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "party_balance", "fieldtype": "Currency", "hidden": 0, @@ -290,6 +332,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "currency_section", "fieldtype": "Section Break", "hidden": 0, @@ -322,6 +365,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "account_currency", "fieldtype": "Link", "hidden": 0, @@ -355,6 +399,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_10", "fieldtype": "Column Break", "hidden": 0, @@ -386,6 +431,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "exchange_rate", "fieldtype": "Float", "hidden": 0, @@ -418,6 +464,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sec_break1", "fieldtype": "Section Break", "hidden": 0, @@ -449,6 +496,7 @@ "bold": 1, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "debit_in_account_currency", "fieldtype": "Currency", "hidden": 0, @@ -482,6 +530,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "debit", "fieldtype": "Currency", "hidden": 0, @@ -517,6 +566,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break2", "fieldtype": "Column Break", "hidden": 0, @@ -547,6 +597,7 @@ "bold": 1, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "credit_in_account_currency", "fieldtype": "Currency", "hidden": 0, @@ -580,6 +631,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "credit", "fieldtype": "Currency", "hidden": 0, @@ -615,6 +667,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "reference", "fieldtype": "Section Break", "hidden": 0, @@ -646,6 +699,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "reference_type", "fieldtype": "Select", "hidden": 0, @@ -679,6 +733,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "reference_name", "fieldtype": "Dynamic Link", "hidden": 0, @@ -713,6 +768,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance'])", + "fetch_if_empty": 0, "fieldname": "reference_due_date", "fieldtype": "Select", "hidden": 0, @@ -746,6 +802,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "project", "fieldtype": "Link", "hidden": 0, @@ -779,6 +836,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break3", "fieldtype": "Column Break", "hidden": 0, @@ -809,6 +867,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "is_advance", "fieldtype": "Select", "hidden": 0, @@ -843,6 +902,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "user_remark", "fieldtype": "Small Text", "hidden": 0, @@ -875,6 +935,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "against_account", "fieldtype": "Text", "hidden": 1, @@ -903,16 +964,14 @@ } ], "has_web_view": 0, - "hide_heading": 0, "hide_toolbar": 0, "idx": 1, - "image_view": 0, "in_create": 0, "is_submittable": 0, "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 19:00:53.662788", + "modified": "2019-04-09 18:48:29.494134", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry Account", @@ -920,7 +979,6 @@ "permissions": [], "quick_entry": 0, "read_only": 0, - "read_only_onload": 0, "show_name_in_global_search": 0, "sort_order": "DESC", "track_changes": 1,