From 22a19e4b6e9cd37e9f68a99a74eb7e28c9bfec94 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 18 Jul 2023 13:59:37 +0000 Subject: [PATCH 1/8] chore(release): Bumped to Version 14.31.0 # [14.31.0](https://github.com/frappe/erpnext/compare/v14.30.7...v14.31.0) (2023-07-18) ### Bug Fixes * `TypeError` while creating WO from PP (backport [#36136](https://github.com/frappe/erpnext/issues/36136)) ([#36137](https://github.com/frappe/erpnext/issues/36137)) ([dd51010](https://github.com/frappe/erpnext/commit/dd5101056dd6f54d13f981c608a80cf868ea2b15)) * Account balance patch and query fixes ([#36117](https://github.com/frappe/erpnext/issues/36117)) ([0147754](https://github.com/frappe/erpnext/commit/0147754273c726d6e64b283231c3cc3c0a83287e)) * Accounts closing balance patch ([#36113](https://github.com/frappe/erpnext/issues/36113)) ([cf29156](https://github.com/frappe/erpnext/commit/cf29156139b56f3aaf72d45095e82a4329348c5e)) * allow manual asset receipt mov from nowhere ([#36093](https://github.com/frappe/erpnext/issues/36093)) ([4aaa1a1](https://github.com/frappe/erpnext/commit/4aaa1a15d7dfe9ad81d3cc1f000dac3e324cfa6f)) * Ambiguous column error while submitting stock entry ([#36058](https://github.com/frappe/erpnext/issues/36058)) ([a3a052b](https://github.com/frappe/erpnext/commit/a3a052bb514a726e1a1ca558f5e02a6c9fab59c6)) * circular dependency during reposting causing timeout error ([2c21404](https://github.com/frappe/erpnext/commit/2c21404813719a666c443964aa3583d2ad731538)) * get_dimension with_cost_center_and_project=false is not working ([#35974](https://github.com/frappe/erpnext/issues/35974)) ([42c93a1](https://github.com/frappe/erpnext/commit/42c93a1f000445b736ef64bcf32cfeb69b81ddb4)) * Handle multi-company in patch ([#36127](https://github.com/frappe/erpnext/issues/36127)) ([e7f5754](https://github.com/frappe/erpnext/commit/e7f57542ab26042521873d9a3a6b7135d1566a36)) * improve "Update Items" modal ([#36105](https://github.com/frappe/erpnext/issues/36105)) ([b86571d](https://github.com/frappe/erpnext/commit/b86571d9d450ae0e992713267751bf449a4b4d55)) * incorrect Balance Qty in the stock ledger for the item with Serial and Batch no ([373b868](https://github.com/frappe/erpnext/commit/373b868c1d3a6a10387eee74d0b09c829a361de1)) * incorrect Reserved Qty for Production Plan in BIN for multi-uom case ([2f632d0](https://github.com/frappe/erpnext/commit/2f632d031aa53e1e03763623449e7cde7dca3c55)) * Opening balance in TB report ([#36171](https://github.com/frappe/erpnext/issues/36171)) ([313ad7a](https://github.com/frappe/erpnext/commit/313ad7ae89d77969d5c950ac45a1a2dda60fa881)) * Opening entries showing up incorrectly in TB report ([#36135](https://github.com/frappe/erpnext/issues/36135)) ([d10e5e6](https://github.com/frappe/erpnext/commit/d10e5e666bef96b35af79c68d8e97ad9fb129d83)) * Remove current fiscal year from Global Defaults ([#35960](https://github.com/frappe/erpnext/issues/35960)) ([b877fa6](https://github.com/frappe/erpnext/commit/b877fa60dba309c5dc7809c01a315b1aa6fb2214)) * Trailing opening entries in Accounts closing balance ([#36175](https://github.com/frappe/erpnext/issues/36175)) ([8a607db](https://github.com/frappe/erpnext/commit/8a607db493212414a2c74704930b3aef2c15087a)) * validate docs in closed accounting period on save ([#36157](https://github.com/frappe/erpnext/issues/36157)) ([5985e02](https://github.com/frappe/erpnext/commit/5985e02574e387ef92a2bf0a9d2d1b49ad57cdd3)) ### Features * add local holidays ([#36116](https://github.com/frappe/erpnext/issues/36116)) ([94caf7f](https://github.com/frappe/erpnext/commit/94caf7f5a86c3028b93a34525f1478eb2ba24d17)) * add project filter in reports importing financial statements js file ([#36097](https://github.com/frappe/erpnext/issues/36097)) ([63e26e3](https://github.com/frappe/erpnext/commit/63e26e39d47e963868c2ca69afbf970c41de2808)) ### Performance Improvements * index in `Item` and `Item Variant Attribute` (backport [#36133](https://github.com/frappe/erpnext/issues/36133)) ([#36144](https://github.com/frappe/erpnext/issues/36144)) ([6198983](https://github.com/frappe/erpnext/commit/619898350af2090fb4f68e1638fb7c77da12c589)) * send SLA doctypes in boot ([adb6918](https://github.com/frappe/erpnext/commit/adb69188340e5ec841caf70d67f3c81c554b958b)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 73dd306905a..fb11f9711cf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.7" +__version__ = "14.31.0" def get_default_company(user=None): From ff0b51ecdb44cfbbbb24e3df32f66def84be47a8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 18 Jul 2023 17:36:38 +0530 Subject: [PATCH 2/8] fix: broken overallocation validation in payment entry In a multi term payment schedule, overallocation logic broke. Fixing it using individual term outstanding amount in references. this should work for the simple, one term payment schedule as well (cherry picked from commit f8d4b19cb987b267dbd18d6ef1ab52426d7f51d1) --- .../doctype/payment_entry/payment_entry.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 5011b9296cd..f4f31d957d1 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -182,10 +182,12 @@ class PaymentEntry(AccountsController): latest_lookup = {} for d in latest_references: d = frappe._dict(d) - latest_lookup.update({(d.voucher_type, d.voucher_no): d}) + latest_lookup.setdefault((d.voucher_type, d.voucher_no), frappe._dict())[d.payment_term] = d for d in self.get("references"): - latest = latest_lookup.get((d.reference_doctype, d.reference_name)) + latest = (latest_lookup.get((d.reference_doctype, d.reference_name)) or frappe._dict()).get( + d.payment_term + ) # The reference has already been fully paid if not latest: @@ -208,6 +210,18 @@ class PaymentEntry(AccountsController): if (flt(d.allocated_amount)) > 0 and flt(d.allocated_amount) > flt(latest.outstanding_amount): frappe.throw(fail_message.format(d.idx)) + if d.payment_term and ( + (flt(d.allocated_amount)) > 0 + and flt(d.allocated_amount) > flt(latest.payment_term_outstanding) + ): + frappe.throw( + _( + "Row #{0}: Allocated amount:{1} is greater than outstanding amount:{2} for Payment Term {3}" + ).format( + d.idx, d.allocated_amount, latest.payment_term_outstanding, d.payment_term + ) + ) + # Check for negative outstanding invoices as well if flt(d.allocated_amount) < 0 and flt(d.allocated_amount) < flt(latest.outstanding_amount): frappe.throw(fail_message.format(d.idx)) @@ -1466,6 +1480,7 @@ def split_invoices_based_on_payment_terms(outstanding_invoices): "posting_date": d.posting_date, "invoice_amount": flt(d.invoice_amount), "outstanding_amount": flt(d.outstanding_amount), + "payment_term_outstanding": flt(payment_term.outstanding), "payment_amount": payment_term.payment_amount, "payment_term": payment_term.payment_term, } @@ -2240,6 +2255,7 @@ def get_reference_as_per_payment_terms( "due_date": doc.get("due_date"), "total_amount": grand_total, "outstanding_amount": outstanding_amount, + "payment_term_outstanding": payment_term_outstanding, "payment_term": payment_term.payment_term, "allocated_amount": payment_term_outstanding, } From dd25c83c3091f1cec8b0a6183d4574ebe62921e4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 19 Jul 2023 09:26:39 +0530 Subject: [PATCH 3/8] refactor: payment term outstanding in party account currency (cherry picked from commit ee83f94bb0ad22e487d63e41cb878ffc27f974fc) --- .../doctype/payment_entry/payment_entry.py | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index f4f31d957d1..f29be181e7b 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1392,7 +1392,9 @@ def get_outstanding_reference_documents(args): accounting_dimensions=accounting_dimensions_filter, ) - outstanding_invoices = split_invoices_based_on_payment_terms(outstanding_invoices) + outstanding_invoices = split_invoices_based_on_payment_terms( + outstanding_invoices, args.get("company") + ) for d in outstanding_invoices: d["exchange_rate"] = 1 @@ -1451,8 +1453,27 @@ def get_outstanding_reference_documents(args): return data -def split_invoices_based_on_payment_terms(outstanding_invoices): +def split_invoices_based_on_payment_terms(outstanding_invoices, company): invoice_ref_based_on_payment_terms = {} + + company_currency = ( + frappe.db.get_value("Company", company, "default_currency") if company else None + ) + exc_rates = frappe._dict() + for doctype in ["Sales Invoice", "Purchase Invoice"]: + invoices = [x.voucher_no for x in outstanding_invoices if x.voucher_type == doctype] + for x in frappe.db.get_all( + doctype, + filters={"name": ["in", invoices]}, + fields=["name", "currency", "conversion_rate", "party_account_currency"], + ): + exc_rates[x.name] = frappe._dict( + conversion_rate=x.conversion_rate, + currency=x.currency, + party_account_currency=x.party_account_currency, + company_currency=company_currency, + ) + for idx, d in enumerate(outstanding_invoices): if d.voucher_type in ["Sales Invoice", "Purchase Invoice"]: payment_term_template = frappe.db.get_value( @@ -1469,6 +1490,14 @@ def split_invoices_based_on_payment_terms(outstanding_invoices): for payment_term in payment_schedule: if payment_term.outstanding > 0.1: + doc_details = exc_rates.get(payment_term.parent, None) + is_multi_currency_acc = (doc_details.currency != doc_details.company_currency) and ( + doc_details.party_account_currency != doc_details.company_currency + ) + payment_term_outstanding = flt(payment_term.outstanding) + if not is_multi_currency_acc: + payment_term_outstanding = doc_details.conversion_rate * flt(payment_term.outstanding) + invoice_ref_based_on_payment_terms.setdefault(idx, []) invoice_ref_based_on_payment_terms[idx].append( frappe._dict( @@ -1480,7 +1509,7 @@ def split_invoices_based_on_payment_terms(outstanding_invoices): "posting_date": d.posting_date, "invoice_amount": flt(d.invoice_amount), "outstanding_amount": flt(d.outstanding_amount), - "payment_term_outstanding": flt(payment_term.outstanding), + "payment_term_outstanding": payment_term_outstanding, "payment_amount": payment_term.payment_amount, "payment_term": payment_term.payment_term, } From 388bbca49298fb862a27b9cb5eb028a8821d0015 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 19 Jul 2023 05:42:32 +0000 Subject: [PATCH 4/8] chore(release): Bumped to Version 14.31.1 ## [14.31.1](https://github.com/frappe/erpnext/compare/v14.31.0...v14.31.1) (2023-07-19) ### Bug Fixes * broken overallocation validation in payment entry ([ff0b51e](https://github.com/frappe/erpnext/commit/ff0b51ecdb44cfbbbb24e3df32f66def84be47a8)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index fb11f9711cf..e433176ceb2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.31.0" +__version__ = "14.31.1" def get_default_company(user=None): From ceea8be483a371a288aa8a5bae8f9b291a3545ad Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 19 Jul 2023 13:17:12 +0530 Subject: [PATCH 5/8] fix: Default fiscal year in accounting, buying and sellingcharts (cherry picked from commit 3759a41b8358302ff8d33857a0461cc2da3d06d8) (cherry picked from commit 8ca3d6b7f3554617f8fb5131a7bd570418c1dac5) --- .../dashboard_chart/budget_variance/budget_variance.json | 5 +++-- .../dashboard_chart/profit_and_loss/profit_and_loss.json | 5 +++-- .../purchase_order_trends/purchase_order_trends.json | 7 ++++--- .../dashboard_chart/top_suppliers/top_suppliers.json | 5 +++-- erpnext/public/js/utils.js | 4 ++++ .../sales_order_trends/sales_order_trends.json | 7 ++++--- .../dashboard_chart/top_customers/top_customers.json | 5 +++-- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/dashboard_chart/budget_variance/budget_variance.json b/erpnext/accounts/dashboard_chart/budget_variance/budget_variance.json index 8631d3dc2a3..4883106227b 100644 --- a/erpnext/accounts/dashboard_chart/budget_variance/budget_variance.json +++ b/erpnext/accounts/dashboard_chart/budget_variance/budget_variance.json @@ -4,18 +4,19 @@ "creation": "2020-07-17 11:25:34.593061", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"erpnext.utils.get_fiscal_year()\",\"to_fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"period\":\"Monthly\",\"budget_against\":\"Cost Center\",\"show_cumulative\":0}", "idx": 0, "is_public": 1, "is_standard": 1, - "modified": "2020-07-22 12:24:49.144210", + "modified": "2023-07-19 13:13:13.307073", "modified_by": "Administrator", "module": "Accounts", "name": "Budget Variance", "number_of_groups": 0, "owner": "Administrator", "report_name": "Budget Variance Report", + "roles": [], "timeseries": 0, "type": "Bar", "use_report_chart": 1, diff --git a/erpnext/accounts/dashboard_chart/profit_and_loss/profit_and_loss.json b/erpnext/accounts/dashboard_chart/profit_and_loss/profit_and_loss.json index 3fa995bbe15..25caa44769b 100644 --- a/erpnext/accounts/dashboard_chart/profit_and_loss/profit_and_loss.json +++ b/erpnext/accounts/dashboard_chart/profit_and_loss/profit_and_loss.json @@ -4,18 +4,19 @@ "creation": "2020-07-17 11:25:34.448572", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"erpnext.utils.get_fiscal_year()\",\"to_fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"filter_based_on\":\"Fiscal Year\",\"period_start_date\":\"2020-04-01\",\"period_end_date\":\"2021-03-31\",\"periodicity\":\"Yearly\",\"include_default_book_entries\":1}", "idx": 0, "is_public": 1, "is_standard": 1, - "modified": "2020-07-22 12:33:48.888943", + "modified": "2023-07-19 13:08:56.470390", "modified_by": "Administrator", "module": "Accounts", "name": "Profit and Loss", "number_of_groups": 0, "owner": "Administrator", "report_name": "Profit and Loss Statement", + "roles": [], "timeseries": 0, "type": "Bar", "use_report_chart": 1, diff --git a/erpnext/buying/dashboard_chart/purchase_order_trends/purchase_order_trends.json b/erpnext/buying/dashboard_chart/purchase_order_trends/purchase_order_trends.json index 6452ed2139b..751796bbbb5 100644 --- a/erpnext/buying/dashboard_chart/purchase_order_trends/purchase_order_trends.json +++ b/erpnext/buying/dashboard_chart/purchase_order_trends/purchase_order_trends.json @@ -5,18 +5,19 @@ "custom_options": "{\"type\": \"line\", \"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"tooltipOptions\": {}, \"lineOptions\": {\"regionFill\": 1}}", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"period\":\"Monthly\",\"period_based_on\":\"posting_date\",\"based_on\":\"Item\"}", - "idx": 0, + "idx": 1, "is_public": 1, "is_standard": 1, - "modified": "2020-07-21 16:13:25.092287", + "modified": "2023-07-19 13:06:42.937941", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Trends", "number_of_groups": 0, "owner": "Administrator", "report_name": "Purchase Order Trends", + "roles": [], "timeseries": 0, "type": "Line", "use_report_chart": 1, diff --git a/erpnext/buying/dashboard_chart/top_suppliers/top_suppliers.json b/erpnext/buying/dashboard_chart/top_suppliers/top_suppliers.json index 6f7da8ea870..f6b97175398 100644 --- a/erpnext/buying/dashboard_chart/top_suppliers/top_suppliers.json +++ b/erpnext/buying/dashboard_chart/top_suppliers/top_suppliers.json @@ -4,18 +4,19 @@ "creation": "2020-07-20 21:01:02.329519", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"period\":\"Monthly\",\"period_based_on\":\"posting_date\",\"based_on\":\"Supplier\"}", "idx": 0, "is_public": 1, "is_standard": 1, - "modified": "2020-07-22 12:43:40.829652", + "modified": "2023-07-19 13:07:41.753556", "modified_by": "Administrator", "module": "Buying", "name": "Top Suppliers", "number_of_groups": 0, "owner": "Administrator", "report_name": "Purchase Receipt Trends", + "roles": [], "timeseries": 0, "type": "Bar", "use_report_chart": 1, diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index ec331289e9a..a6b4ea12bbe 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -352,6 +352,10 @@ $.extend(erpnext.utils, { }, get_fiscal_year: function(date) { + if(!date) { + date = frappe.datetime.get_today(); + } + let fiscal_year = ''; frappe.call({ method: "erpnext.accounts.utils.get_fiscal_year", diff --git a/erpnext/selling/dashboard_chart/sales_order_trends/sales_order_trends.json b/erpnext/selling/dashboard_chart/sales_order_trends/sales_order_trends.json index 914d915d944..2f668a865d7 100644 --- a/erpnext/selling/dashboard_chart/sales_order_trends/sales_order_trends.json +++ b/erpnext/selling/dashboard_chart/sales_order_trends/sales_order_trends.json @@ -5,18 +5,19 @@ "custom_options": "{\"type\": \"line\", \"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"tooltipOptions\": {}, \"lineOptions\": {\"regionFill\": 1}}", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"period\":\"Monthly\",\"based_on\":\"Item\"}", - "idx": 0, + "idx": 1, "is_public": 1, "is_standard": 1, - "modified": "2020-07-22 16:24:45.726270", + "modified": "2023-07-19 13:09:45.341791", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Trends", "number_of_groups": 0, "owner": "Administrator", "report_name": "Sales Order Trends", + "roles": [], "timeseries": 0, "type": "Line", "use_report_chart": 1, diff --git a/erpnext/selling/dashboard_chart/top_customers/top_customers.json b/erpnext/selling/dashboard_chart/top_customers/top_customers.json index 59a2ba37ddf..2972980967c 100644 --- a/erpnext/selling/dashboard_chart/top_customers/top_customers.json +++ b/erpnext/selling/dashboard_chart/top_customers/top_customers.json @@ -5,18 +5,19 @@ "custom_options": "", "docstatus": 0, "doctype": "Dashboard Chart", - "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}", + "dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"erpnext.utils.get_fiscal_year()\"}", "filters_json": "{\"period\":\"Yearly\",\"based_on\":\"Customer\"}", "idx": 0, "is_public": 1, "is_standard": 1, - "modified": "2020-07-22 17:03:10.320147", + "modified": "2023-07-19 13:14:20.151502", "modified_by": "Administrator", "module": "Selling", "name": "Top Customers", "number_of_groups": 0, "owner": "Administrator", "report_name": "Delivery Note Trends", + "roles": [], "timeseries": 0, "type": "Bar", "use_report_chart": 1, From d6168ca979572963a37a76643fde4c5cb87ae90a Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 19 Jul 2023 08:10:33 +0000 Subject: [PATCH 6/8] chore(release): Bumped to Version 14.31.2 ## [14.31.2](https://github.com/frappe/erpnext/compare/v14.31.1...v14.31.2) (2023-07-19) ### Bug Fixes * Default fiscal year in accounting, buying and sellingcharts ([ceea8be](https://github.com/frappe/erpnext/commit/ceea8be483a371a288aa8a5bae8f9b291a3545ad)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e433176ceb2..72a4fb10bca 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.31.1" +__version__ = "14.31.2" def get_default_company(user=None): From c5e30f53360ef30cae6db83f0f47917c2ec7d94d Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 20 Jul 2023 17:51:54 +0530 Subject: [PATCH 7/8] fix: Trial Balance report considering cancelled entries (cherry picked from commit fd58bbff6bbed96367544f0ab0be9d992fafef56) (cherry picked from commit ca4f86d5af917a67042df6d78ec264d2a78e5fef) --- .../period_closing_voucher.py | 45 +++++++++---------- .../report/trial_balance/trial_balance.py | 3 ++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index 922722f04d3..49472484ef4 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -126,23 +126,22 @@ class PeriodClosingVoucher(AccountsController): def make_gl_entries(self, get_opening_entries=False): gl_entries = self.get_gl_entries() closing_entries = self.get_grouped_gl_entries(get_opening_entries=get_opening_entries) - if gl_entries: - if len(gl_entries) > 5000: - frappe.enqueue( - process_gl_entries, - gl_entries=gl_entries, - closing_entries=closing_entries, - voucher_name=self.name, - company=self.company, - closing_date=self.posting_date, - queue="long", - ) - frappe.msgprint( - _("The GL Entries will be processed in the background, it can take a few minutes."), - alert=True, - ) - else: - process_gl_entries(gl_entries, closing_entries, self.name, self.company, self.posting_date) + if len(gl_entries) > 5000: + frappe.enqueue( + process_gl_entries, + gl_entries=gl_entries, + closing_entries=closing_entries, + voucher_name=self.name, + company=self.company, + closing_date=self.posting_date, + queue="long", + ) + frappe.msgprint( + _("The GL Entries will be processed in the background, it can take a few minutes."), + alert=True, + ) + else: + process_gl_entries(gl_entries, closing_entries, self.name, self.company, self.posting_date) def get_grouped_gl_entries(self, get_opening_entries=False): closing_entries = [] @@ -330,17 +329,15 @@ def process_gl_entries(gl_entries, closing_entries, voucher_name, company, closi from erpnext.accounts.general_ledger import make_gl_entries try: - make_gl_entries(gl_entries, merge_entries=False) + if gl_entries: + make_gl_entries(gl_entries, merge_entries=False) + make_closing_entries(gl_entries + closing_entries, voucher_name, company, closing_date) - frappe.db.set_value( - "Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Completed" - ) + frappe.db.set_value("Period Closing Voucher", voucher_name, "gle_processing_status", "Completed") except Exception as e: frappe.db.rollback() frappe.log_error(e) - frappe.db.set_value( - "Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Failed" - ) + frappe.db.set_value("Period Closing Voucher", voucher_name, "gle_processing_status", "Failed") def make_reverse_gl_entries(voucher_type, voucher_no): diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 39917f90c93..599c8a312a5 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -231,6 +231,9 @@ def get_opening_balance( (closing_balance.posting_date < filters.from_date) | (closing_balance.is_opening == "Yes") ) + if doctype == "GL Entry": + opening_balance = opening_balance.where(closing_balance.is_cancelled == 0) + if ( not filters.show_unclosed_fy_pl_balances and report_type == "Profit and Loss" From bafb79db508b7cb5021a08944ddaead410c5dd9c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 20 Jul 2023 14:42:49 +0000 Subject: [PATCH 8/8] chore(release): Bumped to Version 14.31.3 ## [14.31.3](https://github.com/frappe/erpnext/compare/v14.31.2...v14.31.3) (2023-07-20) ### Bug Fixes * Trial Balance report considering cancelled entries ([c5e30f5](https://github.com/frappe/erpnext/commit/c5e30f53360ef30cae6db83f0f47917c2ec7d94d)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 72a4fb10bca..5bc2c53cdc3 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.31.2" +__version__ = "14.31.3" def get_default_company(user=None):