From 4d31012df23b359d84c434fe0b618d616d063986 Mon Sep 17 00:00:00 2001 From: Sudharsanan11 Date: Tue, 30 Dec 2025 11:00:39 +0530 Subject: [PATCH 01/13] fix(stock): prevent excess stock reservation (cherry picked from commit e1f9adf4e9b0cfb25acef0c620e354abe7c33128) --- .../doctype/stock_reservation_entry/stock_reservation_entry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py index a6a69f3271e..10bcb17222f 100644 --- a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py +++ b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py @@ -537,6 +537,7 @@ def get_available_qty_to_reserve( & (sre.reserved_qty >= sre.delivered_qty) & (sre.status.notin(["Delivered", "Cancelled"])) ) + .for_update() ) if ignore_sre: From 6f1cfdb1de987303c153a41cc4b26517258f1e54 Mon Sep 17 00:00:00 2001 From: Sudharsanan11 Date: Fri, 26 Dec 2025 18:25:43 +0530 Subject: [PATCH 02/13] fix(stock): remove item image to avoid setting the image of previous item (cherry picked from commit 69e94248c1364e62aeb6b75b67322bf7f40b32b0) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6833036122f..80bc1a34d0d 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -914,6 +914,9 @@ frappe.ui.form.on("Stock Entry Detail", { item_code(frm, cdt, cdn) { var d = locals[cdt][cdn]; + // since some items may not have image, so empty the image field to avoid setting the image of previous item + d.image = ""; + if (d.item_code) { var args = { item_code: d.item_code, From 2d49cc9ab28e49afbdb1e12a432d539a7c40427f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 31 Dec 2025 13:29:08 +0530 Subject: [PATCH 03/13] fix: precision issue causing reservation error --- .../doctype/stock_reservation_entry/stock_reservation_entry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py index 10bcb17222f..ca31f33bf76 100644 --- a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py +++ b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py @@ -445,6 +445,7 @@ class StockReservationEntry(Document): voucher_delivered_qty = flt(delivered_qty) * flt(conversion_factor) allowed_qty = min(self.available_qty, (self.voucher_qty - voucher_delivered_qty - total_reserved_qty)) + allowed_qty = flt(allowed_qty, self.precision("reserved_qty")) qty_to_be_reserved = flt(qty_to_be_reserved, self.precision("reserved_qty")) if self.get("_action") != "submit" and self.voucher_type == "Sales Order" and allowed_qty <= 0: From 4b6097914abfe5f602723dd83faeb1f0082f7e15 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 3 Jan 2026 14:56:12 +0530 Subject: [PATCH 04/13] fix: not able to submit backdated stock reco (cherry picked from commit cccd34b06a28e52e6c9635e3478eecf3e6ade280) # Conflicts: # erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py --- .../repost_item_valuation.py | 9 ++ .../serial_and_batch_bundle.py | 15 ++-- .../test_stock_reconciliation.py | 88 +++++++++++++++++++ 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index 49ba0bf8358..96660288eff 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -69,6 +69,15 @@ class RepostItemValuation(Document): ), ) +<<<<<<< HEAD +======= + def on_discard(self): + self.db_set("status", "Cancelled") + + def repost_now(self): + repost(self) + +>>>>>>> cccd34b06a (fix: not able to submit backdated stock reco) def validate(self): self.set_company() self.validate_period_closing_voucher() diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index aa22e6b8bde..ffd0a0a137d 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -554,7 +554,7 @@ class SerialandBatchBundle(Document): available_qty += flt(d.qty, precision) if not allow_negative_stock: - self.validate_negative_batch(d.batch_no, available_qty) + self.validate_negative_batch(d.batch_no, available_qty, field) d.stock_value_difference = flt(d.qty) * flt(d.incoming_rate) @@ -567,8 +567,8 @@ class SerialandBatchBundle(Document): } ) - def validate_negative_batch(self, batch_no, available_qty): - if available_qty < 0 and not self.is_stock_reco_for_valuation_adjustment(available_qty): + def validate_negative_batch(self, batch_no, available_qty, field=None): + if available_qty < 0 and not self.is_stock_reco_for_valuation_adjustment(available_qty, field=field): msg = f"""Batch No {bold(batch_no)} of an Item {bold(self.item_code)} has negative stock of quantity {bold(available_qty)} in the @@ -576,13 +576,16 @@ class SerialandBatchBundle(Document): frappe.throw(_(msg), BatchNegativeStockError) - def is_stock_reco_for_valuation_adjustment(self, available_qty): + def is_stock_reco_for_valuation_adjustment(self, available_qty, field=None): if ( self.voucher_type == "Stock Reconciliation" and self.type_of_transaction == "Outward" and self.voucher_detail_no - and abs(frappe.db.get_value("Stock Reconciliation Item", self.voucher_detail_no, "qty")) - == abs(available_qty) + and ( + abs(frappe.db.get_value("Stock Reconciliation Item", self.voucher_detail_no, "qty")) + == abs(available_qty) + or field == "total_qty" + ) ): return True diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 61c32d09467..b45934ffebd 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -1557,6 +1557,94 @@ class TestStockReconciliation(FrappeTestCase, StockTestMixin): self.assertFalse(status == "Active") + def test_change_valuation_of_batch_using_backdated_stock_reco(self): + from erpnext.stock.doctype.batch.batch import get_batch_qty + from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry + + item_code = self.make_item( + "Test Item Change Valuation of Batch", + { + "is_stock_item": 1, + "has_batch_no": 1, + "create_new_batch": 1, + "batch_number_series": "TEST-BATCH-CVB-.###", + }, + ).name + + warehouse = "_Test Warehouse - _TC" + + reco = create_stock_reconciliation( + item_code=item_code, + posting_date=add_days(nowdate(), -6), + warehouse=warehouse, + qty=10, + rate=80, + use_serial_batch_fields=1, + ) + + batch_no = get_batch_from_bundle(reco.items[0].serial_and_batch_bundle) + + make_stock_entry( + item_code=item_code, + source=warehouse, + qty=2, + posting_date=add_days(nowdate(), -4), + use_serial_batch_fields=1, + batch_no=batch_no, + ) + + make_stock_entry( + item_code=item_code, + source=warehouse, + qty=2, + posting_date=add_days(nowdate(), -3), + use_serial_batch_fields=1, + batch_no=batch_no, + ) + + se4 = make_stock_entry( + item_code=item_code, + source=warehouse, + qty=2, + posting_date=add_days(nowdate(), -2), + use_serial_batch_fields=1, + batch_no=batch_no, + ) + + sle = frappe.db.get_value( + "Stock Ledger Entry", + {"voucher_no": se4.name, "is_cancelled": 0}, + ["actual_qty", "stock_value_difference"], + as_dict=1, + ) + + valuation_rate = sle.stock_value_difference / sle.actual_qty + self.assertEqual(valuation_rate, 80) + + create_stock_reconciliation( + item_code=item_code, + posting_date=add_days(nowdate(), -5), + warehouse=warehouse, + qty=10, + rate=100, + use_serial_batch_fields=1, + batch_no=batch_no, + ) + + sle = frappe.db.get_value( + "Stock Ledger Entry", + {"voucher_no": se4.name, "is_cancelled": 0}, + ["actual_qty", "stock_value_difference"], + as_dict=1, + ) + + valuation_rate = sle.stock_value_difference / sle.actual_qty + + self.assertEqual(valuation_rate, 100) + + batch_qty = get_batch_qty(batch_no, warehouse, item_code) + self.assertEqual(batch_qty, 4) + def create_batch_item_with_batch(item_name, batch_id): batch_item_doc = create_item(item_name, is_stock_item=1) From 46f3ab1c39be37930a2c7561eeba4ab807872c26 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 3 Jan 2026 15:23:29 +0530 Subject: [PATCH 05/13] chore: fix conflicts Removed unused on_discard method and cleaned up code. --- .../doctype/repost_item_valuation/repost_item_valuation.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index 96660288eff..e3b1b330fad 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -69,15 +69,9 @@ class RepostItemValuation(Document): ), ) -<<<<<<< HEAD -======= - def on_discard(self): - self.db_set("status", "Cancelled") - def repost_now(self): repost(self) ->>>>>>> cccd34b06a (fix: not able to submit backdated stock reco) def validate(self): self.set_company() self.validate_period_closing_voucher() From eebd88529fe3f639f7437cb0f1c52cf736982b76 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 3 Jan 2026 15:43:24 +0530 Subject: [PATCH 06/13] fix: SABB not cancelled on cancel of Stock Reco (cherry picked from commit b2048531931a7485252d5755d86a3a79a5d14ec3) --- .../stock_reconciliation.py | 2 +- .../test_stock_reconciliation.py | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 2bf4333b14e..629a50e1c28 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -879,7 +879,7 @@ class StockReconciliation(StockController): if row.get(dimension.get("fieldname")): has_dimensions = True - if self.docstatus == 2 and (not row.batch_no or not row.serial_and_batch_bundle): + if self.docstatus == 2: if row.current_qty and current_bundle: data.actual_qty = -1 * row.current_qty data.qty_after_transaction = flt(row.current_qty) diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index b45934ffebd..63228e5a764 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -1645,6 +1645,59 @@ class TestStockReconciliation(FrappeTestCase, StockTestMixin): batch_qty = get_batch_qty(batch_no, warehouse, item_code) self.assertEqual(batch_qty, 4) + def test_sabb_cancel_on_stock_reco_cancellation(self): + item_code = self.make_item( + "Test Item for SABB Cancel on Stock Reco Cancellation", + { + "is_stock_item": 1, + "has_batch_no": 1, + "create_new_batch": 1, + "batch_number_series": "TEST-BATCH-SABBCANC-.###", + }, + ).name + + warehouse = "_Test Warehouse - _TC" + + sr = create_stock_reconciliation( + item_code=item_code, + warehouse=warehouse, + qty=10, + rate=100, + use_serial_batch_fields=1, + ) + + sr.reload() + + batch_no = get_batch_from_bundle(sr.items[0].serial_and_batch_bundle) + + sr1 = create_stock_reconciliation( + item_code=item_code, + warehouse=warehouse, + qty=20, + rate=100, + use_serial_batch_fields=1, + batch_no=batch_no, + ) + + sr1.reload() + + current_serial_and_batch_bundle = sr1.items[0].current_serial_and_batch_bundle + serial_and_batch_bundle = sr1.items[0].serial_and_batch_bundle + + self.assertTrue(current_serial_and_batch_bundle) + self.assertTrue(serial_and_batch_bundle) + + sr1.cancel() + + for sabb in [serial_and_batch_bundle, current_serial_and_batch_bundle]: + docstatus = frappe.db.get_value( + "Serial and Batch Bundle", + sabb, + "docstatus", + ) + + self.assertEqual(docstatus, 2) + def create_batch_item_with_batch(item_name, batch_id): batch_item_doc = create_item(item_name, is_stock_item=1) From 728a8b0b7dfcfe04f67d4e0e542a0cd01af00f05 Mon Sep 17 00:00:00 2001 From: SowmyaArunachalam Date: Sat, 3 Jan 2026 14:15:03 +0530 Subject: [PATCH 07/13] fix: update filters on period closing voucher (cherry picked from commit 7ab1e1f6777c9c4287166d565fce1399030affe9) --- .../doctype/period_closing_voucher/period_closing_voucher.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js index f07d90b6ef3..57b05d19d83 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js @@ -13,9 +13,9 @@ frappe.ui.form.on("Period Closing Voucher", { return { filters: [ ["Account", "company", "=", frm.doc.company], - ["Account", "is_group", "=", "0"], + ["Account", "is_group", "=", 0], ["Account", "freeze_account", "=", "No"], - ["Account", "root_type", "in", "Liability, Equity"], + ["Account", "root_type", "in", ["Liability", "Equity"]], ], }; }); From d6511b00451e713d85b99e195ad9afb9b35ab962 Mon Sep 17 00:00:00 2001 From: SowmyaArunachalam Date: Fri, 2 Jan 2026 16:05:36 +0530 Subject: [PATCH 08/13] fix: add company filters to project (cherry picked from commit 7c16db567b50035c9e1dbc6dbed18ff7dd929a8b) # Conflicts: # erpnext/accounts/doctype/journal_entry/journal_entry.js --- .../doctype/journal_entry/journal_entry.js | 17 +++++++++++++++++ .../stock/doctype/stock_entry/stock_entry.js | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index f04bf6b22b3..181edb4cd6b 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -20,6 +20,23 @@ frappe.ui.form.on("Journal Entry", { "Unreconcile Payment Entries", "Bank Transaction", ]; + frm.trigger("set_queries"); + }, + + set_queries(frm) { + frm.set_query("project", "accounts", function (doc, cdt, cdn) { + let row = frappe.get_doc(cdt, cdn); + let filters = { + company: doc.company, + }; + if (row.party_type == "Customer") { + filters.customer = row.party; + } + return { + query: "erpnext.controllers.queries.get_project_name", + filters, + }; + }); }, refresh: function (frm) { diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 80bc1a34d0d..b1a1cdece37 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -140,6 +140,24 @@ frappe.ui.form.on("Stock Entry", { }; }); + frm.set_query("project", "items", function (doc) { + return { + query: "erpnext.controllers.queries.get_project_name", + filters: { + company: doc.company, + }, + }; + }); + + frm.set_query("project", function (doc) { + return { + query: "erpnext.controllers.queries.get_project_name", + filters: { + company: doc.company, + }, + }; + }); + frm.add_fetch("bom_no", "inspection_required", "inspection_required"); erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype); From 1d58e9b91a9d135919c76413881f0ffa6a7cf201 Mon Sep 17 00:00:00 2001 From: Navin-S-R Date: Thu, 25 Dec 2025 10:18:33 +0530 Subject: [PATCH 09/13] fix(journal entry): use submission_queue to perform submit and cancel actions for rows over 100 (cherry picked from commit fa8e80c6a04f885ae9cfffc6d211777aff2ad7a5) --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index f1e9e261309..0aa48dcd721 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -6,6 +6,7 @@ import json import frappe from frappe import _, msgprint, scrub +from frappe.core.doctype.submission_queue.submission_queue import queue_submission from frappe.utils import comma_and, cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate import erpnext @@ -172,15 +173,13 @@ class JournalEntry(AccountsController): def submit(self): if len(self.accounts) > 100: - msgprint(_("The task has been enqueued as a background job."), alert=True) - self.queue_action("submit", timeout=4600) + queue_submission(self, "_submit") else: return self._submit() def cancel(self): if len(self.accounts) > 100: - msgprint(_("The task has been enqueued as a background job."), alert=True) - self.queue_action("cancel", timeout=4600) + queue_submission(self, "_cancel") else: return self._cancel() From 0452820ab0192f3b01bf3a4a703293c484a0078c Mon Sep 17 00:00:00 2001 From: Sowmya <106989392+SowmyaArunachalam@users.noreply.github.com> Date: Tue, 6 Jan 2026 11:07:28 +0530 Subject: [PATCH 10/13] Merge pull request #51458 from aerele/default-age-range feat: add default-age-range in accounts settings (cherry picked from commit f8f82ccf31515c6910125ccc2ab6b7f1f3eb61a8) # Conflicts: # erpnext/accounts/doctype/accounts_settings/accounts_settings.json --- .../doctype/accounts_settings/accounts_settings.json | 11 +++++++++-- .../doctype/accounts_settings/accounts_settings.py | 1 + .../report/accounts_payable/accounts_payable.js | 4 ++++ .../accounts_payable_summary.js | 4 ++++ .../report/accounts_receivable/accounts_receivable.js | 4 ++++ .../accounts_receivable_summary.js | 4 ++++ erpnext/startup/boot.py | 3 +++ 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 35b33b7a195..02f7eeb7095 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -93,6 +93,7 @@ "receivable_payable_remarks_length", "accounts_receivable_payable_tuning_section", "receivable_payable_fetch_method", + "default_ageing_range", "column_break_ntmi", "drop_ar_procedures", "legacy_section", @@ -657,6 +658,12 @@ "fieldname": "show_party_balance", "fieldtype": "Check", "label": "Show Party Balance" + }, + { + "default": "30, 60, 90, 120", + "fieldname": "default_ageing_range", + "fieldtype": "Data", + "label": "Default Ageing Range" } ], "icon": "icon-cog", @@ -664,7 +671,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-11-06 17:48:07.682837", + "modified": "2025-12-26 19:46:55.093717", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", @@ -694,4 +701,4 @@ "sort_order": "ASC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index c54ae9bac65..793f44bd5c8 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -41,6 +41,7 @@ class AccountsSettings(Document): check_supplier_invoice_uniqueness: DF.Check create_pr_in_draft_status: DF.Check credit_controller: DF.Link | None + default_ageing_range: DF.Data | None delete_linked_ledger_entries: DF.Check determine_address_tax_category_from: DF.Literal["Billing Address", "Shipping Address"] enable_common_party_accounting: DF.Check diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index 9af8c93a52e..c061b0c3902 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -165,6 +165,10 @@ frappe.query_reports["Accounts Payable"] = { var filters = report.get_values(); frappe.set_route("query-report", "Accounts Payable Summary", { company: filters.company }); }); + + if (frappe.boot.sysdefaults.default_ageing_range) { + report.set_filter_value("range", frappe.boot.sysdefaults.default_ageing_range); + } }, }; diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js index 6a043f5e185..a4cb0584bf1 100644 --- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js +++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js @@ -114,6 +114,10 @@ frappe.query_reports["Accounts Payable Summary"] = { var filters = report.get_values(); frappe.set_route("query-report", "Accounts Payable", { company: filters.company }); }); + + if (frappe.boot.sysdefaults.default_ageing_range) { + report.set_filter_value("range", frappe.boot.sysdefaults.default_ageing_range); + } }, }; diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index b052d50838d..4255568d1f9 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -192,6 +192,10 @@ frappe.query_reports["Accounts Receivable"] = { var filters = report.get_values(); frappe.set_route("query-report", "Accounts Receivable Summary", { company: filters.company }); }); + + if (frappe.boot.sysdefaults.default_ageing_range) { + report.set_filter_value("range", frappe.boot.sysdefaults.default_ageing_range); + } }, }; diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js index 1ac2b27ca71..c8e59d6e054 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js @@ -137,6 +137,10 @@ frappe.query_reports["Accounts Receivable Summary"] = { var filters = report.get_values(); frappe.set_route("query-report", "Accounts Receivable", { company: filters.company }); }); + + if (frappe.boot.sysdefaults.default_ageing_range) { + report.set_filter_value("range", frappe.boot.sysdefaults.default_ageing_range); + } }, }; diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index 83816f6cc09..ff1141fb07e 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -64,6 +64,9 @@ def boot_session(bootinfo): bootinfo.party_account_types = frappe._dict(party_account_types) bootinfo.sysdefaults.demo_company = frappe.db.get_single_value("Global Defaults", "demo_company") + bootinfo.sysdefaults.default_ageing_range = frappe.db.get_single_value( + "Accounts Settings", "default_ageing_range" + ) def update_page_info(bootinfo): From dc10ef4287d90028f9a4d2ea74b91af32e51d4de Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Tue, 6 Jan 2026 15:49:03 +0530 Subject: [PATCH 11/13] feat: allow data import for asset repair doctype (cherry picked from commit 49f1688a51c54d0011b877c991587e4fd8454949) # Conflicts: # erpnext/assets/doctype/asset_repair/asset_repair.json --- .../assets/doctype/asset_repair/asset_repair.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.json b/erpnext/assets/doctype/asset_repair/asset_repair.json index 9b6d878378b..16028e041eb 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.json +++ b/erpnext/assets/doctype/asset_repair/asset_repair.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_import": 1, "autoname": "naming_series:", "creation": "2017-10-23 11:38:54.004355", "doctype": "DocType", @@ -249,8 +250,18 @@ ], "index_web_pages_for_search": 1, "is_submittable": 1, +<<<<<<< HEAD "links": [], "modified": "2025-11-17 18:35:54.575265", +======= + "links": [ + { + "link_doctype": "Stock Entry", + "link_fieldname": "asset_repair" + } + ], + "modified": "2026-01-06 15:48:13.862505", +>>>>>>> 49f1688a51 (feat: allow data import for asset repair doctype) "modified_by": "Administrator", "module": "Assets", "name": "Asset Repair", @@ -264,6 +275,7 @@ "delete": 1, "email": 1, "export": 1, + "import": 1, "print": 1, "read": 1, "report": 1, @@ -279,6 +291,7 @@ "delete": 1, "email": 1, "export": 1, + "import": 1, "print": 1, "read": 1, "report": 1, From dbd2964139de1f66d39d40447c4ababf0e3a216d Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Tue, 6 Jan 2026 16:46:20 +0530 Subject: [PATCH 12/13] fix: resolve conflict --- .../assets/doctype/asset_repair/asset_repair.json | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.json b/erpnext/assets/doctype/asset_repair/asset_repair.json index 16028e041eb..45e531d6976 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.json +++ b/erpnext/assets/doctype/asset_repair/asset_repair.json @@ -250,18 +250,8 @@ ], "index_web_pages_for_search": 1, "is_submittable": 1, -<<<<<<< HEAD "links": [], - "modified": "2025-11-17 18:35:54.575265", -======= - "links": [ - { - "link_doctype": "Stock Entry", - "link_fieldname": "asset_repair" - } - ], "modified": "2026-01-06 15:48:13.862505", ->>>>>>> 49f1688a51 (feat: allow data import for asset repair doctype) "modified_by": "Administrator", "module": "Assets", "name": "Asset Repair", @@ -308,4 +298,4 @@ "title_field": "asset_name", "track_changes": 1, "track_seen": 1 -} \ No newline at end of file +} From a0566c9e98b6c6e75ad9202bc882536f7b53d31f Mon Sep 17 00:00:00 2001 From: Jatin3128 Date: Thu, 1 Jan 2026 04:38:40 +0530 Subject: [PATCH 13/13] fix(trial balance party): add check for parties with zero credit and debit (cherry picked from commit 83ddaf169640d1676e5a5857f57bfcd499ed6e5f) --- .../trial_balance_for_party.js | 6 ++++++ .../trial_balance_for_party.py | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js index 62482ac162c..ecddd7271ea 100644 --- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js +++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js @@ -81,5 +81,11 @@ frappe.query_reports["Trial Balance for Party"] = { label: __("Show zero values"), fieldtype: "Check", }, + { + fieldname: "exclude_zero_balance_parties", + label: __("Exclude Zero Balance Parties"), + fieldtype: "Check", + default: 1, + }, ], }; diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py index f6c79eb6c45..86c8463b021 100644 --- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py +++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py @@ -75,20 +75,20 @@ def get_data(filters, show_party_name): closing_debit, closing_credit = toggle_debit_credit(opening_debit + debit, opening_credit + credit) row.update({"closing_debit": closing_debit, "closing_credit": closing_credit}) - # totals - for col in total_row: - total_row[col] += row.get(col) - row.update({"currency": company_currency}) has_value = False if opening_debit or opening_credit or debit or credit or closing_debit or closing_credit: has_value = True + # Exclude zero balance parties if filter is set + if filters.get("exclude_zero_balance_parties") and not closing_debit and not closing_credit: + continue if cint(filters.show_zero_values) or has_value: data.append(row) - - # Add total row + # totals + for col in total_row: + total_row[col] += row.get(col) total_row.update({"party": "'" + _("Totals") + "'", "currency": company_currency}) data.append(total_row)