fix: remove state based logic from patch - #4721
Conversation
Up to standards ✅🟢 Issues
|
📝 WalkthroughWalkthroughThe patch entry now includes the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 99d358c4-6599-444b-b8c6-4b53bc7fc672
📒 Files selected for processing (2)
india_compliance/patches.txtindia_compliance/patches/post_install/set_india_compliance_default_tax_category.py
| fields=["name", "is_inter_state", "is_reverse_charge"], | ||
| filters={"disabled": 0, "name": ["in", list(used_categories)]}, | ||
| order_by="creation desc", | ||
| ) | ||
|
|
||
| defaults = [] | ||
| for is_inter_state, is_reverse_charge in DEFAULT_SCENARIOS: | ||
| category = get_default_tax_category( | ||
| tax_categories, used_categories, is_inter_state, is_reverse_charge | ||
| ) | ||
| category = get_default_tax_category(tax_categories, is_inter_state, is_reverse_charge) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Do not use creation time to choose the global default category.
If enabled templates use different category names for the same (is_inter_state, is_reverse_charge) pair, Line 37 places the newest category first. Lines 55-57 then select that category and mark it as the global default.
The downstream lookup searches each company for a template using that single default category. A newer custom or company-specific category can therefore make another company or template type return no automatic tax template.
Select a stable canonical category instead of relying on creation time. Add an integration test with different enabled categories for the same scenario across companies or template doctypes.
Based on Lines 972-993 of india_compliance/gst_india/overrides/transaction.py, the default flag is a global selector for each scenario.
Also applies to: 55-57
Confidence Score: 5/5The reviewed migration behavior is safe to merge based on the exercised category-selection and rerun paths. The actual patch module was executed against category and template fixtures covering all four selection scenarios, disabled and unreferenced categories, and repeat execution. No scoring findings remain. Files Needing Attention: No files need author action. A full Frappe/ERPNext database run remains unavailable locally because the
What T-Rex did
Reviews (1): Last reviewed commit: "fix: remove state based logic from patch" | Re-trigger Greptile |
Issue: Users were using state-based categories, due to which these categories were ignored.