fix(trial balance party): add check for parties with zero credit and debit#51424
Conversation
📝 WalkthroughWalkthroughThis change adds a filter option to the Trial Balance for Party report to optionally exclude parties with zero closing balances. A new Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
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. Comment |
There was a problem hiding this comment.
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: 1changes 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
📒 Files selected for processing (2)
erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.jserpnext/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
continueensures these parties are excluded from both the data and totals, which is the intended behavior.
erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
Outdated
Show resolved
Hide resolved
effd984 to
83ddaf1
Compare
Codecov Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
…-51424 fix(trial balance party): add check for parties with zero credit and debit (backport #51424)
Add a check "Exclude Zero Balance Parties" in the trial balance party report to filter out the rows with zero closing debit/credit.