fix: auto set company gstin in jv#4279
fix: auto set company gstin in jv#4279ljain112 wants to merge 4 commits intoresilient-tech:developfrom
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Confidence Score: 4/5Safe to merge after fixing missing super() calls in the new test class. The production fix in journal_entry.py is clean and correct. The P1 finding is confined to the new test class missing super().setUpClass() / super().tearDownClass(), which could leave the test harness in a bad state for subsequent test classes but does not affect runtime behaviour. india_compliance/gst_india/overrides/test_journal_entry.py — missing super() calls in setUp/tearDownClass
|
| Filename | Overview |
|---|---|
| india_compliance/gst_india/overrides/journal_entry.py | Core fix: refactors validate() to auto-set company_gstin when the company has exactly one GSTIN, and throws only when multiple GSTINs are registered. Logic is clean and well-structured. |
| india_compliance/gst_india/overrides/test_journal_entry.py | New test file; missing super().setUpClass() and super().tearDownClass() calls which are required by IntegrationTestCase to initialise and clean up framework-level state. |
| india_compliance/gst_india/utils/tests.py | Consolidates previously duplicated create_itc_reversal_journal_entry and create_itc_reclaim_journal_entry helpers into the shared test utility module with tax_amount and company parameterisation. Well-implemented refactor. |
| india_compliance/gst_india/report/gst_purchase_register/test_gst_purchase_register.py | Removes local _create_journal_entry helper and delegates to the shared utilities. Tax amounts are now passed explicitly, removing the hard-coded default. Clean refactor. |
| india_compliance/gst_india/doctype/gstr_3b_report/test_gstr_3b_report.py | Switches to shared utility imports and passes explicit tax_amount=9 where previously a default was relied on. Straightforward import update. |
Reviews (3): Last reviewed commit: "test: refactor test cases" | Re-trigger Greptile
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request refactors test utilities and enhances journal entry validation in the GST India module. It extracts duplicate test helper functions into a shared utilities module with four new functions for creating journal entries and ITC-related account rows. The journal entry validation logic is updated to automatically populate the 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Review rate limit: 0/1 reviews remaining, refill in 52 minutes and 53 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 917bdbbb-51eb-4966-9c96-d848d5e0510c
📒 Files selected for processing (5)
india_compliance/gst_india/doctype/gstr_3b_report/test_gstr_3b_report.pyindia_compliance/gst_india/overrides/journal_entry.pyindia_compliance/gst_india/overrides/test_journal_entry.pyindia_compliance/gst_india/report/gst_purchase_register/test_gst_purchase_register.pyindia_compliance/gst_india/utils/tests.py
| def setUpClass(cls): | ||
| frappe.db.savepoint("before_test_journal_entry") |
There was a problem hiding this comment.
Missing
super().setUpClass() call
TestJournalEntry.setUpClass never calls super().setUpClass(), unlike every other IntegrationTestCase subclass in this codebase (e.g. TestGSTPurchaseRegister calls it on line 41). IntegrationTestCase.setUpClass typically initialises database state and wraps the class in its own savepoint. Skipping it means any per-class initialisation from the framework is not applied, and the class-level savepoint managed by the parent is never created. Similarly, tearDownClass skips super().tearDownClass(), so any parent-class cleanup (e.g. releasing the class savepoint, resetting frappe state) is never run.
| def setUpClass(cls): | |
| frappe.db.savepoint("before_test_journal_entry") | |
| @classmethod | |
| def setUpClass(cls): | |
| super().setUpClass() | |
| frappe.db.savepoint("before_test_journal_entry") |
| def tearDownClass(cls): | ||
| frappe.db.rollback(save_point="before_test_journal_entry") |
There was a problem hiding this comment.
Missing
super().tearDownClass() call
The counterpart issue: tearDownClass doesn't call super().tearDownClass(). If IntegrationTestCase.tearDownClass commits or tears down the framework-level savepoint, skipping it can leave the test harness in an unexpected state for subsequent test classes.
| def tearDownClass(cls): | |
| frappe.db.rollback(save_point="before_test_journal_entry") | |
| @classmethod | |
| def tearDownClass(cls): | |
| frappe.db.rollback(save_point="before_test_journal_entry") | |
| super().tearDownClass() |
closes: #4230
Note: Added Journal Entry test cases