feat: Template for P&L and BS of Schedule III#3993
feat: Template for P&L and BS of Schedule III#3993Abdeali099 wants to merge 17 commits intodevelopfrom
Conversation
india_compliance/income_tax_india/financial_report_template/account_categories.json
Outdated
Show resolved
Hide resolved
india_compliance/income_tax_india/financial_report_template/account_categories.json
Outdated
Show resolved
Hide resolved
india_compliance/income_tax_india/financial_report_template/account_categories.json
Outdated
Show resolved
Hide resolved
india_compliance/income_tax_india/financial_report_template/account_categories.json
Outdated
Show resolved
Hide resolved
india_compliance/income_tax_india/financial_report_template/account_categories.json
Outdated
Show resolved
Hide resolved
...rt_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).json
Outdated
Show resolved
Hide resolved
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis pull request introduces financial report templates for India compliance, specifically Schedule III formats. It adds two new JSON template files defining a Standard Balance Sheet and Standard Profit and Loss statement with hierarchical rows, formulas, and account mappings. An 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_`(schedule_iii)/standard_balance_sheet_(schedule_iii).json:
- Around line 90-121: Several Schedule III line items (reference_code values
SF_MONEY_WARRANTS, SHARE_APP_MONEY, NCL_DTL, NCA_CWIP, NCA_INTANGIBLE_DEV,
NCA_DTA, NCA_LOANS_ADV, CA_LOANS_ADV) are hardcoded with "calculation_formula":
"0" and "data_source": "Calculated Amount", which silently zeroes material
balances and understates parent aggregates (e.g., NCL_TOTAL, NCA_TOTAL,
NCA_FIXED_ASSETS, CA_TOTAL); fix by switching those entries to use
"data_source": "Account Data" and a proper calculation_formula that pulls the
mapped ERPNext account totals (or the appropriate aggregate function) when those
account_category mappings exist, and if mappings do not exist set
"hide_when_empty": 1 for each offending entry (or add a visible disclaimer row)
so users are warned; update the entries identified by their reference_code above
(and the repeated blocks noted at the other ranges) rather than line numbers.
In
`@india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_`(schedule_iii)/standard_profit_and_loss_(schedule_iii).json:
- Around line 366-413: DISCONTINUING_OPS and DISCONTINUING_TAX have inconsistent
reverse_sign values which will break the calculation_formula in
DISCONTINUING_AFTER_TAX when real account mappings are added; update the
reverse_sign on DISCONTINUING_TAX to match DISCONTINUING_OPS (make both
reverse_sign: 1) so both profit/loss items use the same sign convention and the
formula DISCONTINUING_AFTER_TAX = DISCONTINUING_OPS - DISCONTINUING_TAX yields
correct results.
- Around line 190-205: The EXP_DEPRECIATION row currently filters only by
["account_type","=","Depreciation"], which causes accounts that are both
Depreciation and account_category = "Cost of Goods Sold" to be counted again in
EXP_MATERIALS/EXP_STOCK_TRADE/EXP_FINANCE; fix by updating the JSON filters:
either add ["account_type","!=","Depreciation"] to each of EXP_MATERIALS,
EXP_STOCK_TRADE and EXP_FINANCE (so COGS buckets exclude depreciation) or modify
EXP_DEPRECIATION to also require ["account_category","!=","Cost of Goods Sold"]
— update the calculation_formula arrays for those entries (EXP_MATERIALS,
EXP_STOCK_TRADE, EXP_FINANCE or EXP_DEPRECIATION) to include the appropriate
exclusion condition.
In `@india_compliance/patches/v16/sync_financial_report_templates.py`:
- Line 1: The file sync_financial_report_templates.py has the wrong copyright
header; replace the existing top-line copyright (currently referencing 2025 and
Frappe Technologies Pvt. Ltd.) with the project's standard header "# Copyright
(c) 2026, Resilient Tech and contributors" so it matches the three new
__init__.py files in this PR and the repo convention.
- Around line 5-7: The patch imports the internal function _sync_templates_for
(aliased as sync_financial_report_templates) from
erpnext.accounts.doctype.financial_report_template.financial_report_template
which is unstable; remove this private import and instead implement syncing via
a stable mechanism—either call ERPNext's REST resource /api/resource/Financial
Report Template to CRUD templates programmatically or load them as fixtures
during deployment; replace usages of sync_financial_report_templates with the
new REST/fixture-based flow and ensure error handling and idempotency around
creating/updating Financial Report Template records.
...rt_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).json
Outdated
Show resolved
Hide resolved
...emplate/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json
Outdated
Show resolved
Hide resolved
...emplate/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json
Outdated
Show resolved
Hide resolved
india_compliance/patches/v16/sync_financial_report_templates.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_`(schedule_iii)/standard_profit_and_loss_(schedule_iii).json:
- Around line 206-221: The EXP_OTHER entry's advanced_filtering is incorrectly
set to 0 even though its calculation_formula uses multiple account_name "not
like" conditions; update the EXP_OTHER object's "advanced_filtering" value from
0 to 1 so the account_name filters are applied (ensure you edit the object with
reference_code "EXP_OTHER" and its calculation_formula that contains the
account_name exclusions).
---
Duplicate comments:
In `@india_compliance/patches/v16/sync_financial_report_templates.py`:
- Line 1: Update the copyright header in
india_compliance/patches/v16/sync_financial_report_templates.py by replacing
"Frappe Technologies Pvt. Ltd. and contributors" with "Resilient Tech and
contributors" so the file reflects the correct copyright owner; ensure the year
(2026) remains unchanged and the rest of the header line is preserved exactly.
...emplate/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json
Outdated
Show resolved
Hide resolved
12cad59 to
37a5175
Compare
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@india_compliance/patches/v16/sync_financial_report_templates.py`:
- Around line 5-7: You are importing and using the ERPNext-internal symbol
_sync_templates_for (aliased as sync_financial_report_templates) — this is an
accepted but fragile dependency, so add a clear inline comment documenting the
risk and wrap the import/use in a runtime guard: attempt to import or getattr
the symbol (_sync_templates_for) from
erpnext.accounts.doctype.financial_report_template.financial_report_template
inside a try/except, and if missing log/raise a clear, actionable error telling
integrators to verify the function exists (suggest the provided ripgrep command)
or to use the public replacement; ensure the code references the exact symbol
names _sync_templates_for and sync_financial_report_templates so future
reviewers can find and update the fallback.
- Line 1: Update the file header string "Copyright (c) 2026, Frappe Technologies
Pvt. Ltd. and contributors" to the project-standard copyright holder and format
(i.e. replace "Frappe Technologies Pvt. Ltd." with the correct organization name
used across the repo while keeping the updated year 2026), ensuring the exact
header line is changed to "Copyright (c) 2026, <Project Standard Copyright
Holder> and contributors".
Confidence Score: 5/5Safe to merge; only remaining finding is a P2 inconsistency in depreciation exclusion filters that is unlikely to affect standard COA setups. All previously raised P1 concerns (hardcoded zeros, copyright header) are resolved in this version. The one new finding — missing standard_profit_and_loss_(schedule_iii).json — review the depreciation exclusion consistency across all expense category rows.
|
| Filename | Overview |
|---|---|
| india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json | New Schedule III P&L template with correctly structured revenue/expense/tax hierarchy; EXP_EMPLOYEE and EXP_OTHER lack the account_type != "Depreciation" exclusion applied to the other three expense rows, risking double-counting. |
| india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).json | New Schedule III Balance Sheet template; all previously hardcoded-zero items (CWIP, DTA, DTL, etc.) are now properly mapped via Account Data with new categories; CA_LOANS_ADV ("Short-Term Loans and Advances") still uses "Other Receivables" category which is a separate known concern. |
| india_compliance/income_tax_india/financial_report_template/account_categories.json | Adds nine new account categories (CWIP, DTA, DTL, Employee Benefits, Intangible Assets Under Development, Long-term Loans and Advances, etc.) that back the new template mappings; missing trailing newline at EOF. |
| india_compliance/patches/v16/sync_financial_report_templates.py | Patch that syncs the new templates on upgrade by calling the private ERPNext function _sync_templates_for; copyright header is now correct ("Resilient Tech and contributors"). |
| india_compliance/patches.txt | Appends the new sync patch to the end of the patch list, removing a trailing blank line. |
Reviews (2): Last reviewed commit: "fix: changes as per review" | Re-trigger Greptile
| "include_in_charts": 0, | ||
| "indentation_level": 1, | ||
| "italic_text": 0, | ||
| "reference_code": "CA_OTHER", | ||
| "reverse_sign": 0 | ||
| }, | ||
| { | ||
| "advanced_filtering": 0, | ||
| "balance_type": "", | ||
| "bold_text": 0, | ||
| "data_source": "Blank Line", |
There was a problem hiding this comment.
Account category mismatch for "Short-Term Loans and Advances"
The display_name is "e. Short-Term Loans and Advances" but the calculation_formula filters on account_category = "Other Receivables". Under Schedule III, these are distinct classifications — Short-Term Loans and Advances covers advances to subsidiaries, deposits, advance tax, etc., while Other Receivables typically covers miscellaneous receivables. Using "Other Receivables" here will pull the wrong set of accounts and may both miss genuine loans/advances and inadvertently include unrelated receivables.
Consider mapping this to a dedicated account category (e.g., "Loans and Advances" or the equivalent category used in the Indian chart of accounts) or, if such a category does not exist in the standard COA, document why "Other Receivables" is the intended proxy.
| "include_in_charts": 0, | |
| "indentation_level": 1, | |
| "italic_text": 0, | |
| "reference_code": "CA_OTHER", | |
| "reverse_sign": 0 | |
| }, | |
| { | |
| "advanced_filtering": 0, | |
| "balance_type": "", | |
| "bold_text": 0, | |
| "data_source": "Blank Line", | |
| "calculation_formula": "[\"account_category\", \"=\", \"Loans and Advances\"]", | |
| "display_name": "e. Short-Term Loans and Advances", |
| "hidden_calculation": 0, | ||
| "hide_when_empty": 0, | ||
| "include_in_charts": 0, | ||
| "indentation_level": 2, | ||
| "italic_text": 0, | ||
| "reference_code": "NCA_INTANGIBLE_DEV", | ||
| "reverse_sign": 0 | ||
| }, | ||
| { | ||
| "advanced_filtering": 0, | ||
| "balance_type": "Closing Balance", | ||
| "bold_text": 0, | ||
| "calculation_formula": "[\"account_category\", \"=\", \"Long-term Investments\"]", |
There was a problem hiding this comment.
Important Balance Sheet categories hardcoded to zero
Several Schedule III line items that many companies actively use are hardcoded to "calculation_formula": "0" with "data_source": "Calculated Amount", meaning they will always display as ₹0 regardless of what accounts exist in the books:
NCA_CWIP— Capital Work-in-Progress (reverse_sign: 0/ lines 452–465)NCA_INTANGIBLE_DEV— Intangible Assets Under Development (lines 467–481)NCL_DTL— Deferred Tax Liabilities (Net) (lines 177–191)NCA_DTA— Deferred Tax Assets (Net) (lines 498–513)NCA_LOANS_ADV— Long-Term Loans and Advances (lines 515–529)SF_MONEY_WARRANTS— Money Received Against Share Warrants (lines 112–127)SHARE_APP_MONEY— Share Application Money Pending Allotment (lines 128–143)
For NCA_CWIP, ERPNext's Indian COA has a "Capital Work in Progress" account type or similar category that could be mapped. Silently returning 0 for these items means users won't notice that data is missing, which could result in a materially incorrect Balance Sheet.
| from erpnext.accounts.doctype.financial_report_template.financial_report_template import ( | ||
| _sync_templates_for as sync_financial_report_templates, | ||
| ) |
There was a problem hiding this comment.
Importing a private function from ERPNext
_sync_templates_for is prefixed with an underscore, marking it as an internal/private function in the ERPNext codebase. Relying on private APIs is fragile — the function signature or existence could change across ERPNext releases without notice, silently breaking this patch.
If a public equivalent exists (or can be added to ERPNext), that would be safer. At minimum, this dependency should be noted in the PR/changelog so future upgraders are aware.
| @@ -0,0 +1,13 @@ | |||
| # Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and contributors | |||
There was a problem hiding this comment.
Copyright header names wrong entity
All other files added in this PR use "Resilient Tech and contributors" as the copyright holder, but this patch file uses "Frappe Technologies Pvt. Ltd. and contributors". This should be consistent with the rest of the app.
| # Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and contributors | |
| # Copyright (c) 2026, Resilient Tech and contributors |
|
Rebase and resolve conflicts |
3094fd3 to
823136b
Compare
Done 🆗 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
|
Tip: Greploops — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d3b55447-c41c-478b-b9bb-ab5a59abafa0
📒 Files selected for processing (5)
india_compliance/income_tax_india/financial_report_template/account_categories.jsonindia_compliance/income_tax_india/financial_report_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).jsonindia_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).jsonindia_compliance/patches.txtindia_compliance/patches/v16/sync_financial_report_templates.py
✅ Files skipped from review due to trivial changes (2)
- india_compliance/income_tax_india/financial_report_template/account_categories.json
- india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json
🚧 Files skipped from review as they are similar to previous changes (2)
- india_compliance/patches/v16/sync_financial_report_templates.py
- india_compliance/patches.txt
| { | ||
| "advanced_filtering": 0, | ||
| "balance_type": "Closing Balance", | ||
| "bold_text": 0, | ||
| "calculation_formula": "[\"account_category\", \"=\", \"Other Receivables\"]", | ||
| "data_source": "Account Data", | ||
| "display_name": "e. Short-Term Loans and Advances", | ||
| "fieldtype": "", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check category names defined in fixtures and where both terms are used
rg -n --glob '**/*.json' '"account_category_name"\s*:\s*"Short-term Loans and Advances"|"account_category_name"\s*:\s*"Other Receivables"'
rg -n 'CA_LOANS_ADV|Short-Term Loans and Advances|Other Receivables' india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_\(schedule_iii\)/standard_balance_sheet_\(schedule_iii\).jsonRepository: resilient-tech/india-compliance
Length of output: 57
🏁 Script executed:
# First, check if the file exists and read lines around 605-612
head -620 india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_\(schedule_iii\)/standard_balance_sheet_\(schedule_iii\).json | tail -30Repository: resilient-tech/india-compliance
Length of output: 1244
🏁 Script executed:
# Also search for account category definitions
rg -n "account_category" india_compliance/ -t json --max-count=20Repository: resilient-tech/india-compliance
Length of output: 9149
🏁 Script executed:
# Search for where these specific category names appear in the codebase
rg -n "Other Receivables" india_compliance/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 310
🏁 Script executed:
# Search for Short-Term/Short-term variants
rg -n -i "short.term.*loans.*advances|short.term.*loan" india_compliance/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 283
🏁 Script executed:
# Search for Short-Term Loans and Advances anywhere
rg -i "short.term.*loans.*advances" india_compliance/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 279
🏁 Script executed:
# Read the complete account_categories.json to see all defined categories
cat india_compliance/income_tax_india/financial_report_template/account_categories.jsonRepository: resilient-tech/india-compliance
Length of output: 2899
🏁 Script executed:
# Check if there are other definitions for categories beyond account_categories.json
find india_compliance -name "*categor*.json" -type fRepository: resilient-tech/india-compliance
Length of output: 158
🏁 Script executed:
# Also search for other instances of "Other Receivables" to understand how it's used
rg -n "Other Receivables" india_compliance/ -t json -A 2 -B 2Repository: resilient-tech/india-compliance
Length of output: 1072
🏁 Script executed:
# Search for all uses of "Other Receivables" to see if it's a pattern
rg -n '"Other Receivables"' india_compliance/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 57
🏁 Script executed:
# Check for a potential "Short-term Receivables" or similar category
rg -i "receivables" india_compliance/income_tax_india/financial_report_template/account_categories.jsonRepository: resilient-tech/india-compliance
Length of output: 304
🏁 Script executed:
# Look at the complete balance sheet structure around this area to understand the pattern
sed -n '590,630p' india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_\(schedule_iii\)/standard_balance_sheet_\(schedule_iii\).jsonRepository: resilient-tech/india-compliance
Length of output: 1695
🏁 Script executed:
# Final verification: search entire codebase for "Other Receivables" definition
rg -i 'account_category.*other receivables|other receivables.*account' india_compliance/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 306
🏁 Script executed:
# Check if perhaps it's defined with underscores or different format
rg -i 'other.*receivable' india_compliance/income_tax_india/financial_report_template/ -t jsonRepository: resilient-tech/india-compliance
Length of output: 306
Fix the undefined category filter: "Other Receivables" is not defined in account_categories.json.
The row uses "calculation_formula": "[\"account_category\", \"=\", \"Other Receivables\"]" but this category does not exist. The display name says "Short-Term Loans and Advances", yet the defined categories include only "Long-term Loans and Advances". Either:
- Use the correct defined category ("Long-term Loans and Advances"), or
- Add "Short-term Loans and Advances" to
account_categories.jsonif it's a distinct required category.
no-docsNote
Backport to V-16