From eb5505187e7a993edba478f6a09a7e83d7839e4f Mon Sep 17 00:00:00 2001 From: trustedcomputer Date: Mon, 22 Jul 2024 12:35:46 -0700 Subject: [PATCH 01/10] fix: header_img field schema --- .../gocardless_settings.json | 185 +++--------------- 1 file changed, 26 insertions(+), 159 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.json b/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.json index cca36536ac4..80eccce62fe 100644 --- a/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.json +++ b/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.json @@ -1,211 +1,78 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, + "actions": [], "autoname": "field:gateway_name", - "beta": 0, "creation": "2018-02-06 16:11:10.028249", - "custom": 0, - "docstatus": 0, "doctype": "DocType", - "document_type": "", "editable_grid": 1, "engine": "InnoDB", + "field_order": [ + "gateway_name", + "section_break_2", + "access_token", + "webhooks_secret", + "use_sandbox", + "header_img" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "gateway_name", "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Payment Gateway 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": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 + "unique": 1 }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "section_break_2", - "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, - "unique": 0 + "fieldtype": "Section Break" }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "access_token", "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Access Token", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "webhooks_secret", "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": "Webhooks Secret", - "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, - "unique": 0 + "label": "Webhooks Secret" }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, + "default": "0", "fieldname": "use_sandbox", "fieldtype": "Check", - "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": "Use Sandbox", - "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, - "unique": 0 + "label": "Use Sandbox" + }, + { + "fieldname": "header_img", + "fieldtype": "Attach Image", + "label": "Header Image" } ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2022-02-12 14:18:47.209114", + "links": [], + "modified": "2024-07-22 12:34:26.791274", "modified_by": "Administrator", "module": "ERPNext Integrations", "name": "GoCardless Settings", - "name_case": "", + "naming_rule": "By fieldname", "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 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": "System Manager", - "set_user_permissions": 0, "share": 1, - "submit": 0, "write": 1 } ], - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 -} + "states": [], + "track_changes": 1 +} \ No newline at end of file From 7d1d0c8e0c7e4d708b49f3e70e7a00e20314ec5b Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Mon, 30 Dec 2024 17:56:17 +0530 Subject: [PATCH 02/10] fix: add monthly distributation and write query in qb (cherry picked from commit 27195c7c9640b06eb548a8505dd6f83e623d552d) --- erpnext/accounts/doctype/budget/budget.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index 22b8d64971c..d4b5640e80b 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -460,13 +460,19 @@ def get_actual_expense(args): def get_accumulated_monthly_budget(monthly_distribution, posting_date, fiscal_year, annual_budget): distribution = {} if monthly_distribution: - for d in frappe.db.sql( - """select mdp.month, mdp.percentage_allocation - from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md - where mdp.parent=md.name and md.fiscal_year=%s""", - fiscal_year, - as_dict=1, - ): + mdp = frappe.qb.DocType("Monthly Distribution Percentage") + md = frappe.qb.DocType("Monthly Distribution") + + query = ( + frappe.qb.from_(mdp) + .join(md) + .on(mdp.parent == md.name) + .select(mdp.month, mdp.percentage_allocation) + .where(md.fiscal_year == fiscal_year) + .where(md.name == monthly_distribution) + ) + + for d in query.run(as_dict=True): distribution.setdefault(d.month, d.percentage_allocation) dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date") From 24ae74ebb396d99355f355c95f615f3c1cfa27dc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 31 Dec 2024 17:04:37 +0530 Subject: [PATCH 03/10] refactor: store result in variable before enumeration helps to inspect result while debugging (cherry picked from commit b60bd17d1ddc9cc61d9fba44eb495bec174d66b2) --- erpnext/accounts/doctype/budget/budget.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py index d4b5640e80b..0fe40d2d5fe 100644 --- a/erpnext/accounts/doctype/budget/budget.py +++ b/erpnext/accounts/doctype/budget/budget.py @@ -463,16 +463,17 @@ def get_accumulated_monthly_budget(monthly_distribution, posting_date, fiscal_ye mdp = frappe.qb.DocType("Monthly Distribution Percentage") md = frappe.qb.DocType("Monthly Distribution") - query = ( + res = ( frappe.qb.from_(mdp) .join(md) .on(mdp.parent == md.name) .select(mdp.month, mdp.percentage_allocation) .where(md.fiscal_year == fiscal_year) .where(md.name == monthly_distribution) + .run(as_dict=True) ) - for d in query.run(as_dict=True): + for d in res: distribution.setdefault(d.month, d.percentage_allocation) dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date") From 2d63fc98d076101bef8fcb6ea107bca7c5f3d524 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:58:36 +0530 Subject: [PATCH 04/10] fix: update customer contact details on pos (backport #45071) (#45105) fix: update customer contact details on pos (#45071) * fix: update customer contact details on pos * refactor: removed console log statement (cherry picked from commit d79e5612484a547cbe6828476d60a87a815568fd) Co-authored-by: Diptanil Saha --- erpnext/selling/page/point_of_sale/pos_item_cart.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js index eb84796c2d0..e4af306a488 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -913,10 +913,13 @@ erpnext.PointOfSale.ItemCart = class { const me = this; dfs.forEach((df) => { this[`customer_${df.fieldname}_field`] = frappe.ui.form.make_control({ - df: { ...df, onchange: handle_customer_field_change }, + df: df, parent: $customer_form.find(`.${df.fieldname}-field`), render_input: true, }); + this[`customer_${df.fieldname}_field`].$input?.on("blur", () => { + handle_customer_field_change.apply(this[`customer_${df.fieldname}_field`]); + }); this[`customer_${df.fieldname}_field`].set_value(this.customer_info[df.fieldname]); }); From affa67e74d65ff2d5d01cd8bcfc85cce6244cfda Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 6 Jan 2025 15:23:57 +0530 Subject: [PATCH 05/10] fix: Returned Qty in Work Order Consumed Materials report (cherry picked from commit 30d68a31e09553421ac91af78b1dfdeded81d6f5) --- .../work_order_consumed_materials.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py index 64363e20e39..a5690c477e4 100644 --- a/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py +++ b/erpnext/manufacturing/report/work_order_consumed_materials/work_order_consumed_materials.py @@ -50,7 +50,11 @@ def get_returned_materials(work_orders): raw_materials = frappe.get_all( "Stock Entry", - fields=["`tabStock Entry Detail`.`item_code`", "`tabStock Entry Detail`.`qty`"], + fields=[ + "`tabStock Entry`.`work_order`", + "`tabStock Entry Detail`.`item_code`", + "`tabStock Entry Detail`.`qty`", + ], filters=[ ["Stock Entry", "is_return", "=", 1], ["Stock Entry Detail", "docstatus", "=", 1], @@ -59,12 +63,14 @@ def get_returned_materials(work_orders): ) for d in raw_materials: - raw_materials_qty[d.item_code] += d.qty + key = (d.work_order, d.item_code) + raw_materials_qty[key] += d.qty for row in work_orders: row.returned_qty = 0.0 - if raw_materials_qty.get(row.raw_material_item_code): - row.returned_qty = raw_materials_qty.get(row.raw_material_item_code) + key = (row.parent, row.raw_material_item_code) + if raw_materials_qty.get(key): + row.returned_qty = raw_materials_qty.get(key) def get_fields(): From 07653c54f382d6294bf52f522d1360210a2c8e8d Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Mon, 6 Jan 2025 23:12:53 +0100 Subject: [PATCH 06/10] fix(Project): make status in confirmation dialog translatable (#45118) (cherry picked from commit 9eede907f892dbf2c03d976270164e318091dcfa) --- erpnext/projects/doctype/project/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index b5d169f2364..d85f93c2845 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -190,7 +190,7 @@ frappe.ui.form.on("Project", { }, set_status: function (frm, status) { - frappe.confirm(__("Set Project and all Tasks to status {0}?", [status.bold()]), () => { + frappe.confirm(__("Set Project and all Tasks to status {0}?", [__(status).bold()]), () => { frappe .xcall("erpnext.projects.doctype.project.project.set_project_status", { project: frm.doc.name, From 01d2794968fdd0d0102d2fc8ffe8a836b21d6d78 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 7 Jan 2025 11:14:42 +0530 Subject: [PATCH 07/10] fix: discount resetting on date change revert #44989 (cherry picked from commit 886281f81a2c1d39f736aea5100a61d6ddd08325) --- erpnext/public/js/controllers/transaction.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 6c83756a006..9f8aa84f836 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -841,7 +841,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } transaction_date() { - this.apply_pricing_rule() if (this.frm.doc.transaction_date) { this.frm.transaction_date = this.frm.doc.transaction_date; frappe.ui.form.trigger(this.frm.doc.doctype, "currency"); @@ -850,7 +849,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe posting_date() { var me = this; - me.apply_pricing_rule() if (this.frm.doc.posting_date) { this.frm.posting_date = this.frm.doc.posting_date; From 821cfe2c39e14b636c9e4f3afaf967c50cf04e51 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 6 Jan 2025 20:27:06 +0530 Subject: [PATCH 08/10] fix: Missing company filter breaks `get_account_balance` in Bank Reco (cherry picked from commit 8de0fe78eaa3c6798a9fa002513ee912852f661c) --- .../bank_reconciliation_tool.js | 2 ++ .../bank_reconciliation_tool.py | 26 ++++++++++--------- .../data_table_manager.js | 3 ++- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js index 10c0781e1d3..6b5e1489b61 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js @@ -116,6 +116,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { args: { bank_account: frm.doc.bank_account, till_date: frappe.datetime.add_days(frm.doc.bank_statement_from_date, -1), + company: frm.doc.company, }, callback: (response) => { frm.set_value("account_opening_balance", response.message); @@ -131,6 +132,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { args: { bank_account: frm.doc.bank_account, till_date: frm.doc.bank_statement_to_date, + company: frm.doc.company, }, callback: (response) => { frm.cleared_balance = response.message; diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py index a122e303c68..6fb4ea59ec1 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py @@ -5,11 +5,6 @@ import json import frappe -from frappe import _ -from frappe.model.document import Document -from frappe.query_builder.custom import ConstantColumn -from frappe.utils import cint, flt - from erpnext import get_default_cost_center from erpnext.accounts.doctype.bank_transaction.bank_transaction import get_total_allocated_amount from erpnext.accounts.party import get_party_account @@ -19,6 +14,10 @@ from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_s ) from erpnext.accounts.utils import get_balance_on from erpnext.setup.utils import get_exchange_rate +from frappe import _ +from frappe.model.document import Document +from frappe.query_builder.custom import ConstantColumn +from frappe.utils import cint, flt class BankReconciliationTool(Document): @@ -59,10 +58,17 @@ def get_bank_transactions(bank_account, from_date=None, to_date=None): @frappe.whitelist() -def get_account_balance(bank_account, till_date): +def get_account_balance(bank_account, till_date, company): # returns account balance till the specified date account = frappe.db.get_value("Bank Account", bank_account, "account") - filters = frappe._dict({"account": account, "report_date": till_date, "include_pos_transactions": 1}) + filters = frappe._dict( + { + "account": account, + "report_date": till_date, + "include_pos_transactions": 1, + "company": company, + } + ) data = get_entries(filters) balance_as_per_system = get_balance_on(filters["account"], filters["report_date"]) @@ -74,11 +80,7 @@ def get_account_balance(bank_account, till_date): amounts_not_reflected_in_system = get_amounts_not_reflected_in_system(filters) - bank_bal = ( - flt(balance_as_per_system) - flt(total_debit) + flt(total_credit) + amounts_not_reflected_in_system - ) - - return bank_bal + return flt(balance_as_per_system) - flt(total_debit) + flt(total_credit) + amounts_not_reflected_in_system @frappe.whitelist() diff --git a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js index a88d00c5d35..fc83fb8486e 100644 --- a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js +++ b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js @@ -16,7 +16,7 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { } make_dt() { - var me = this; + const me = this; frappe.call({ method: "erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_bank_transactions", args: { @@ -195,6 +195,7 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { args: { bank_account: this.bank_account, till_date: this.bank_statement_to_date, + company: this.company, }, callback: (response) => (this.cleared_balance = response.message), }); From 46894a5b86132dde4d8c0ee4dedabf7da21af377 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 6 Jan 2025 21:14:41 +0530 Subject: [PATCH 09/10] fix: Override pre-commit behaviour due to conflicts with CI (cherry picked from commit d7bf73cffa5628c185f4ceabd6020c7e4daf54a6) --- .../bank_reconciliation_tool/bank_reconciliation_tool.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py index 6fb4ea59ec1..fba81741912 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py @@ -5,6 +5,11 @@ import json import frappe +from frappe import _ +from frappe.model.document import Document +from frappe.query_builder.custom import ConstantColumn +from frappe.utils import cint, flt + from erpnext import get_default_cost_center from erpnext.accounts.doctype.bank_transaction.bank_transaction import get_total_allocated_amount from erpnext.accounts.party import get_party_account @@ -14,10 +19,6 @@ from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_s ) from erpnext.accounts.utils import get_balance_on from erpnext.setup.utils import get_exchange_rate -from frappe import _ -from frappe.model.document import Document -from frappe.query_builder.custom import ConstantColumn -from frappe.utils import cint, flt class BankReconciliationTool(Document): From 8d13ef050e717cd403828a3c5691b6a1b67de178 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 8 Jan 2025 09:00:21 +0530 Subject: [PATCH 10/10] Revert "fix: Missing company filter breaks `get_account_balance` in Bank Reco (backport #45112)" --- .../bank_reconciliation_tool.js | 2 -- .../bank_reconciliation_tool.py | 17 +++++++---------- .../data_table_manager.js | 3 +-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js index 6b5e1489b61..10c0781e1d3 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js @@ -116,7 +116,6 @@ frappe.ui.form.on("Bank Reconciliation Tool", { args: { bank_account: frm.doc.bank_account, till_date: frappe.datetime.add_days(frm.doc.bank_statement_from_date, -1), - company: frm.doc.company, }, callback: (response) => { frm.set_value("account_opening_balance", response.message); @@ -132,7 +131,6 @@ frappe.ui.form.on("Bank Reconciliation Tool", { args: { bank_account: frm.doc.bank_account, till_date: frm.doc.bank_statement_to_date, - company: frm.doc.company, }, callback: (response) => { frm.cleared_balance = response.message; diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py index fba81741912..a122e303c68 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py @@ -59,17 +59,10 @@ def get_bank_transactions(bank_account, from_date=None, to_date=None): @frappe.whitelist() -def get_account_balance(bank_account, till_date, company): +def get_account_balance(bank_account, till_date): # returns account balance till the specified date account = frappe.db.get_value("Bank Account", bank_account, "account") - filters = frappe._dict( - { - "account": account, - "report_date": till_date, - "include_pos_transactions": 1, - "company": company, - } - ) + filters = frappe._dict({"account": account, "report_date": till_date, "include_pos_transactions": 1}) data = get_entries(filters) balance_as_per_system = get_balance_on(filters["account"], filters["report_date"]) @@ -81,7 +74,11 @@ def get_account_balance(bank_account, till_date, company): amounts_not_reflected_in_system = get_amounts_not_reflected_in_system(filters) - return flt(balance_as_per_system) - flt(total_debit) + flt(total_credit) + amounts_not_reflected_in_system + bank_bal = ( + flt(balance_as_per_system) - flt(total_debit) + flt(total_credit) + amounts_not_reflected_in_system + ) + + return bank_bal @frappe.whitelist() diff --git a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js index fc83fb8486e..a88d00c5d35 100644 --- a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js +++ b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js @@ -16,7 +16,7 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { } make_dt() { - const me = this; + var me = this; frappe.call({ method: "erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool.get_bank_transactions", args: { @@ -195,7 +195,6 @@ erpnext.accounts.bank_reconciliation.DataTableManager = class DataTableManager { args: { bank_account: this.bank_account, till_date: this.bank_statement_to_date, - company: this.company, }, callback: (response) => (this.cleared_balance = response.message), });