feat: Template for P&L and BS of Schedule III (backport #3993)#4273
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 11 |
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: 3/5Safe to merge for the fixture/template changes; the test utility account-mutation behavior warrants a fix before the test suite is expanded. One P1 in create_account (silently overwrites structural account fields on collision) and one P2 pattern-matching gap in the P&L template pull the score below a clean 4. The core fixture and patch logic is sound. india_compliance/tests/erpnext_test_utils.py (create_account mutation) and the P&L JSON template (employee expense pattern coverage).
|
| Filename | Overview |
|---|---|
| india_compliance/income_tax_india/financial_report_template/test_schedule_iii.py | New test for Schedule III P&L and Balance Sheet templates; journal entries are deliberately reversed for sign-reversal testing, which is internally consistent but may be confusing. |
| india_compliance/tests/erpnext_test_utils.py | Shared test utility file copied from ERPNext; contains many unused functions and a create_account implementation that silently modifies existing accounts on name collision. |
| india_compliance/patches/v16/sync_financial_report_templates.py | Minimal patch that delegates to ERPNext's _sync_templates_for; straightforward and correct. |
| india_compliance/income_tax_india/financial_report_template/account_categories.json | Defines 8 India-specific account categories for Schedule III; two description strings are missing a space before "Examples:". |
| india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json | Complete Schedule III P&L template; advanced filtering uses name-based patterns for employee expenses, which can miss accounts whose names don't match any of the listed keywords. |
| india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).json | Complete Schedule III Balance Sheet template with Balance Check row; structure and formulas look correct. |
| india_compliance/patches.txt | Patch entry for sync_financial_report_templates appended correctly. |
Comments Outside Diff (2)
-
india_compliance/tests/erpnext_test_utils.py, line 1613-1639 (link)create_accountsilently overwrites existing account's parentWhen an account with the same
account_nameandcompanyalready exists, the function updates itsparent_account(andis_group) to whatever was passed in and saves — potentially reparenting a live chart-of-accounts entry. Any other test or patch that relies on the original parent of that account will see corrupted data after this call.The
tearDownClassrollback guards the test run itself, but if a real system account name ever collides (or the rollback fails), the chart of accounts is silently mutated. A safer pattern is to raise or return early if the account already exists rather than overwriting structural fields:if account: return account # already exists, return as-is
-
india_compliance/tests/erpnext_test_utils.py, line 1527-1530 (link)Many unused functions imported and defined
erpnext_test_utils.pycopies numerous functions from ERPNext test helpers (create_task,make_project_template,make_project,get_rm_items,make_bom,create_subcontracting_order,create_fiscal_year) that are not referenced anywhere in this PR. The top-levelfrom erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_orderalso runs eagerly on every import of this module, adding an unnecessary dependency.If these are placeholders for future tests, consider adding them only when they are actually needed to keep the module lean and avoid accidental import failures.
Reviews (1): Last reviewed commit: "test: use consistent test date in Schedu..." | Re-trigger Greptile
493a196 to
a02d549
Compare
Manual backport: #3993