Skip to content

fix: update tds section to show section also#4285

Open
ljain112 wants to merge 8 commits intoresilient-tech:developfrom
ljain112:update-tds-sections
Open

fix: update tds section to show section also#4285
ljain112 wants to merge 8 commits intoresilient-tech:developfrom
ljain112:update-tds-sections

Conversation

@ljain112
Copy link
Copy Markdown
Member

@ljain112 ljain112 commented May 6, 2026

For better clarity update TDS sections with the section code.
image

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 6, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

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.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 6, 2026

Confidence Score: 5/5

Safe to merge — all three previously flagged issues are resolved and no new defects were found.

The missing validate hook is now registered, search_tds_sections has the correct signature with **kwargs, the test calls the function with all six required positional arguments, and the tds_details.json values are already in the correct format. The v16 migration patch correctly handles the remaining upgrade scenario and is properly ordered in patches.txt.

No files require special attention.

Important Files Changed

Filename Overview
india_compliance/hooks.py Adds validate hook for Tax Withholding Category (addressing a previously flagged gap) and registers the new client script for the TDS section autocomplete.
india_compliance/income_tax_india/overrides/tax_withholding_category.py Adds validate to reject invalid tds_section values and search_tds_sections (whitelisted) with the correct 6-arg + **kwargs signature to drive the autocomplete dropdown.
india_compliance/income_tax_india/overrides/test_tax_withholding_category.py Adds tests for empty, valid, and invalid tds_section values and for the case-insensitive description search; search_tds_sections is called with all six required positional args.
india_compliance/income_tax_india/data/tds_details.json All tds_section values use the correct {section} - {code} format (e.g. 392(7) - 1004) matching what get_tds_section_value produces and what validate accepts.
india_compliance/patches/v16/update_tds_section_display_name.py Migrates existing records whose tds_section is stored as a bare numeric code (e.g. 1004) to the full display format (e.g. 392(7) - 1004); correctly skips entries with an empty section string.
india_compliance/income_tax_india/client_scripts/tax_withholding_category.js New client script that wires tds_section to the search_tds_sections server function via set_query, enabling the searchable autocomplete dropdown.

Reviews (4): Last reviewed commit: "fix: add validate hook for tax withholdi..." | Re-trigger Greptile

Comment thread india_compliance/income_tax_india/overrides/tax_withholding_category.py Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@ljain112 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 52 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d148b71-71e2-4af5-941b-da21ea68dd39

📥 Commits

Reviewing files that changed from the base of the PR and between 60e8c37 and ba1881c.

📒 Files selected for processing (1)
  • india_compliance/income_tax_india/overrides/tax_withholding_category.py
📝 Walkthrough

Walkthrough

Replaced simple TDS section codes with a NEW_TDS_SECTION mapping and updated get_tds_section_value to format section display. Added a client script for the Tax Withholding Category form that queries a new server-side search_tds_sections function. Updated tds_details.json entries to use formatted section references. Moved on_change logic, added a patch script to update existing records, and extended tests to cover TDS section search.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating TDS section display to include the section code for clarity.
Description check ✅ Passed The description directly relates to the changeset, explaining the purpose of updating TDS sections with section codes and providing a visual example.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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
Copy Markdown

@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: 4

♻️ Duplicate comments (1)
india_compliance/income_tax_india/constants/__init__.py (1)

397-399: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Verify the canonical tds_section format — get_tds_section_value and tds_details.json disagree.

get_tds_section_value(code) returns "<section> - <code>" (e.g., "392(7) - 1004"), and this is the format the validator (get_valid_tds_section_values), the v16 display-name patch, and the autocomplete (search_tds_sections) all rely on.

However, india_compliance/income_tax_india/data/tds_details.json stores values like "1004-392(7)" (<code>-<section>, no spaces, reverse order). These two formats are not interchangeable, so fixture-loaded categories will fail the new validate().

Pick one canonical format and align both producers (this helper + the JSON fixture, plus the v14/v16 patches) to it. See the comment on tds_details.json for full impact.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f765c98-aa9f-406c-9907-ce5dd7d6f395

📥 Commits

Reviewing files that changed from the base of the PR and between 5db41f6 and 8ad2385.

📒 Files selected for processing (10)
  • india_compliance/hooks.py
  • india_compliance/income_tax_india/client_scripts/tax_withholding_category.js
  • india_compliance/income_tax_india/constants/__init__.py
  • india_compliance/income_tax_india/constants/custom_fields.py
  • india_compliance/income_tax_india/data/tds_details.json
  • india_compliance/income_tax_india/overrides/tax_withholding_category.py
  • india_compliance/income_tax_india/overrides/test_tax_withholding_category.py
  • india_compliance/patches.txt
  • india_compliance/patches/v14/migrate_and_update_tds_section_as_per_income_tax_act_2025.py
  • india_compliance/patches/v16/update_tds_section_display_name.py

Comment thread india_compliance/income_tax_india/constants/__init__.py
Comment thread india_compliance/income_tax_india/data/tds_details.json Outdated
@ljain112
Copy link
Copy Markdown
Member Author

ljain112 commented May 6, 2026

@greptileai

Comment thread india_compliance/income_tax_india/overrides/test_tax_withholding_category.py Outdated
@ljain112
Copy link
Copy Markdown
Member Author

ljain112 commented May 6, 2026

@greptileai

@ljain112
Copy link
Copy Markdown
Member Author

ljain112 commented May 6, 2026

@greptileai

@ljain112
Copy link
Copy Markdown
Member Author

ljain112 commented May 6, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
india_compliance/income_tax_india/overrides/test_tax_withholding_category.py (1)

259-285: 💤 Low value

do_not_save flag appears unused after the validate-hook removal.

Based on the commit history ("fix: add validate hook" → "fix: remove validation for section_code"), this flag was added to support an unsaved-doc test for a validate hook that was subsequently removed. No test in this file currently passes do_not_save=True. Consider removing it to keep the helper lean, or keep it if the flag is needed by backport-branch tests.

🧹 Proposed cleanup
-def create_tax_withholding_category(category_name, account_name, **kwargs):
+def create_tax_withholding_category(category_name, account_name, **kwargs):
     fiscal_year = get_fiscal_year(today(), company=COMPANY, as_dict=True)
-    do_not_save = kwargs.pop("do_not_save", False)
     tax_withholding_rate = kwargs.pop("tax_withholding_rate", 10)
     ...
-    if not do_not_save:
-        doc.save()
+    doc.save()
     return doc

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79a0a6f1-1f19-42d7-9848-22540a5afb93

📥 Commits

Reviewing files that changed from the base of the PR and between 8ad2385 and 60e8c37.

📒 Files selected for processing (6)
  • india_compliance/income_tax_india/constants/__init__.py
  • india_compliance/income_tax_india/data/tds_details.json
  • india_compliance/income_tax_india/overrides/tax_withholding_category.py
  • india_compliance/income_tax_india/overrides/test_tax_withholding_category.py
  • india_compliance/patches/v14/migrate_and_update_tds_section_as_per_income_tax_act_2025.py
  • india_compliance/patches/v16/update_tds_section_display_name.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant