Skip to content

fix(trial balance party): add check for parties with zero credit and debit#51424

Merged
ruthra-kumar merged 1 commit intofrappe:developfrom
Jatin3128:trial-balance-party-fix
Jan 6, 2026
Merged

fix(trial balance party): add check for parties with zero credit and debit#51424
ruthra-kumar merged 1 commit intofrappe:developfrom
Jatin3128:trial-balance-party-fix

Conversation

@Jatin3128
Copy link
Contributor

Add a check "Exclude Zero Balance Parties" in the trial balance party report to filter out the rows with zero closing debit/credit.

Screenshot 2026-01-01 at 4 39 44 AM

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Dec 31, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

📝 Walkthrough

Walkthrough

This change adds a filter option to the Trial Balance for Party report to optionally exclude parties with zero closing balances. A new exclude_zero_balance_parties Check field filter (enabled by default) is added to the report configuration in JavaScript. The Python backend implements the filtering logic by skipping rows with zero closing balances when the filter is enabled, and adjusts the total row accumulation to occur after row filtering to ensure totals reflect only displayed rows.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

needs-tests

Suggested reviewers

  • ruthra-kumar

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a check/filter to exclude parties with zero balances in the trial balance report.
Description check ✅ Passed The description clearly explains the feature addition with a specific checkbox label and filtering behavior, directly relating to the changeset.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between effd984 and 83ddaf1.

📒 Files selected for processing (2)
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Patch Test
  • GitHub Check: Python Unit Tests (3)
  • GitHub Check: Python Unit Tests (2)
  • GitHub Check: Python Unit Tests (4)
  • GitHub Check: Python Unit Tests (1)
  • GitHub Check: Summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js (1)

84-89: Good addition, but note the default behavior change.

The filter configuration is correctly implemented. The filter name, type, and label are appropriate.

However, note that setting default: 1 changes the report's default behavior: parties with zero closing balances will now be hidden by default. While this is likely an improvement for most users (reducing clutter), existing users accustomed to seeing all parties may need to explicitly disable this filter to restore the previous view.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 767bb53 and effd984.

📒 Files selected for processing (2)
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: diptanilsaha
Repo: frappe/erpnext PR: 49712
File: erpnext/accounts/report/financial_statements.py:531-539
Timestamp: 2025-09-26T08:52:41.228Z
Learning: The Account Closing Balance doctype includes debit_in_reporting_currency and credit_in_reporting_currency fields, making it compatible with reporting currency queries in financial statements.
📚 Learning: 2025-12-16T05:33:58.723Z
Learnt from: Abdeali099
Repo: frappe/erpnext PR: 51078
File: erpnext/accounts/doctype/financial_report_template/financial_report_engine.py:486-491
Timestamp: 2025-12-16T05:33:58.723Z
Learning: In ERPNext/Frappe codebase, query.run(as_dict=True) returns frappe._dict objects that support both dict-style access (obj["key"]) and attribute-style access (obj.key). Therefore, attribute access on query results is valid and will not raise AttributeError. When reviewing Python code, prefer attribute access (obj.key) for readability where the key is known to exist, but ensure existence checks or fallback handling if there is any doubt about missing keys.

Applied to files:

  • erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Patch Test
  • GitHub Check: Python Unit Tests (4)
  • GitHub Check: Python Unit Tests (1)
  • GitHub Check: Python Unit Tests (3)
  • GitHub Check: Python Unit Tests (2)
  • GitHub Check: Summary
🔇 Additional comments (1)
erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py (1)

83-85: LGTM!

The filter check correctly skips parties with zero closing balances when enabled. Using continue ensures these parties are excluded from both the data and totals, which is the intended behavior.

@Jatin3128 Jatin3128 force-pushed the trial-balance-party-fix branch from effd984 to 83ddaf1 Compare January 1, 2026 08:20
@codecov
Copy link

codecov bot commented Jan 1, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.05%. Comparing base (349db6c) to head (83ddaf1).
⚠️ Report is 79 commits behind head on develop.

Files with missing lines Patch % Lines
...trial_balance_for_party/trial_balance_for_party.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #51424      +/-   ##
===========================================
- Coverage    79.05%   79.05%   -0.01%     
===========================================
  Files         1179     1179              
  Lines       121306   121319      +13     
===========================================
+ Hits         95897    95904       +7     
- Misses       25409    25415       +6     
Files with missing lines Coverage Δ
...trial_balance_for_party/trial_balance_for_party.py 0.00% <0.00%> (ø)

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ruthra-kumar ruthra-kumar merged commit 8fdf6a9 into frappe:develop Jan 6, 2026
18 checks passed
ruthra-kumar added a commit that referenced this pull request Jan 6, 2026
…-51424

fix(trial balance party): add check for parties with zero credit and debit (backport #51424)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport version-15-hotfix needs-tests This PR needs automated unit-tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trial Balance for party, ledgers with zero closing debit and zero closing credit should not be displayed in the report

2 participants