Skip to content

feat: Template for P&L and BS of Schedule III#3993

Open
Abdeali099 wants to merge 17 commits intodevelopfrom
Abdeali/schedule-III
Open

feat: Template for P&L and BS of Schedule III#3993
Abdeali099 wants to merge 17 commits intodevelopfrom
Abdeali/schedule-III

Conversation

@Abdeali099
Copy link
Copy Markdown
Member

@Abdeali099 Abdeali099 commented Feb 16, 2026

@Abdeali099 Abdeali099 marked this pull request as ready for review February 23, 2026 05:22
@Abdeali099 Abdeali099 requested a review from vorasmit February 23, 2026 05:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 23, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This 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 account_categories.json file defines nine account categories used by these templates. Supporting __init__.py files establish package structure. A new patch module syncs the financial report templates during installation, and the patch registry is updated to include this synchronization step.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'feat: Template for P&L and BS of Schedule III' clearly summarizes the main change - adding new P&L and Balance Sheet templates for Schedule III.
Description check ✅ Passed The description references the linked issue #3819 and indicates this is a backport to V-16, which is directly related to the changeset of adding financial report templates.
Linked Issues check ✅ Passed The PR implements standard P&L and Balance Sheet templates for Schedule III as required by issue #3819, with proper JSON template definitions, account categories, and patch synchronization.
Out of Scope Changes check ✅ Passed All changes are focused on adding financial report templates (P&L and BS for Schedule III), account categories, and necessary infrastructure - all directly aligned with issue #3819 objectives.

✏️ 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.

❤️ 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: 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.

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

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.

🤖 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".

@ljain112
Copy link
Copy Markdown
Member

@greptileai

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 18, 2026

Confidence Score: 5/5

Safe 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 account_type != "Depreciation" guard on EXP_EMPLOYEE and EXP_OTHER — is a P2 that only manifests if non-standard accounts have both a matching category and account_type = "Depreciation", which is not typical for the ERPNext Indian COA.

standard_profit_and_loss_(schedule_iii).json — review the depreciation exclusion consistency across all expense category rows.

Vulnerabilities

No security concerns identified. The PR adds JSON fixture data and a patch; there is no user-controlled input, query injection surface, or credential handling.

Important Files Changed

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

Comment on lines +631 to +641
"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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Suggested change
"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",

Comment on lines +453 to +465
"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\"]",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +5 to +7
from erpnext.accounts.doctype.financial_report_template.financial_report_template import (
_sync_templates_for as sync_financial_report_templates,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Suggested change
# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and contributors
# Copyright (c) 2026, Resilient Tech and contributors

@Abdeali099 Abdeali099 self-assigned this Mar 20, 2026
@ljain112
Copy link
Copy Markdown
Member

@Abdeali099

Rebase and resolve conflicts

@Abdeali099 Abdeali099 force-pushed the Abdeali/schedule-III branch from 3094fd3 to 823136b Compare March 25, 2026 11:23
@Abdeali099
Copy link
Copy Markdown
Member Author

@Abdeali099

Rebase and resolve conflicts

Done 🆗

@ljain112
Copy link
Copy Markdown
Member

ljain112 commented Apr 8, 2026

@greptileai

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 8, 2026

Tip:

Greploops — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3b55447-c41c-478b-b9bb-ab5a59abafa0

📥 Commits

Reviewing files that changed from the base of the PR and between 823136b and cfc2eec.

📒 Files selected for processing (5)
  • india_compliance/income_tax_india/financial_report_template/account_categories.json
  • india_compliance/income_tax_india/financial_report_template/standard_balance_sheet_(schedule_iii)/standard_balance_sheet_(schedule_iii).json
  • india_compliance/income_tax_india/financial_report_template/standard_profit_and_loss_(schedule_iii)/standard_profit_and_loss_(schedule_iii).json
  • india_compliance/patches.txt
  • india_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

Comment on lines +605 to +612
{
"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": "",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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\).json

Repository: 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 -30

Repository: 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=20

Repository: 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 json

Repository: 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 json

Repository: 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 json

Repository: 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.json

Repository: 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 f

Repository: 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 2

Repository: 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 json

Repository: 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.json

Repository: 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\).json

Repository: 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 json

Repository: 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 json

Repository: 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.json if it's a distinct required category.

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.

v16 - Standard templates for custom financial statements

3 participants