Skip to content

fix: add additional inward supply fields to document view and excel export#4283

Open
Priyal208 wants to merge 3 commits intoresilient-tech:developfrom
Priyal208:pur-recon
Open

fix: add additional inward supply fields to document view and excel export#4283
Priyal208 wants to merge 3 commits intoresilient-tech:developfrom
Priyal208:pur-recon

Conversation

@Priyal208
Copy link
Copy Markdown
Member

@Priyal208 Priyal208 commented May 6, 2026

Add additional inward supply fields to document view and excel export

  • Show GSTR-1 and GSTR-3B filing status in document view
  • Show ITC Availability and Reason for ITC Unavailability
  • Show e-Invoice details (IRN Source, IRN Number, IRN Generation Date)
  • Fix missing Differences column in excel export
  • Include all new columns in excel export with appropriate formatting

@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 2 duplication

Metric Results
Duplication 2

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.

@Priyal208
Copy link
Copy Markdown
Member Author

@greptileai

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 6, 2026

Confidence Score: 5/5

Straightforward additive change — no existing logic is modified, and the null-handling path for records without an inward supply is preserved correctly throughout the stack.

The change is purely additive: new fields are threaded consistently through the Python data layer, Excel export, and JS column definitions. The previously-flagged null-guard issue for gstr_1_filled/gstr_3b_filled has been applied in both the JS view and the Python assign_value branch. No existing reconciliation or export logic is altered.

No files require special attention.

Important Files Changed

Filename Overview
india_compliance/gst_india/doctype/purchase_reconciliation_tool/init.py Adds 7 new inward-supply fields to the ReconciledData projection list, the empty-defaults dict, and the update_fields output. The null-handling path is intact: fields come through as None for missing inward supply records (empty frappe._dict), so assign_value's is-None guard fires correctly.
india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py Adds assign_value branch for gstr_1_filled/gstr_3b_filled (converts 0/1 to No/Yes while letting the existing is-None guard produce empty cells), adds the missing Differences column and 7 new inward-supply columns to the Excel layout.
india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js Inserts 7 column descriptors (ITC Availability, Reason for ITC Unavailability, GSTR-1 Filed, GSTR-3B Filed, IRN Source, IRN Number, IRN Generation Date) into the document view. The gstr_*_filled callbacks correctly use the three-way null/0/1 guard already requested in a prior review cycle.
india_compliance/gst_india/data/test_purchase_reconciliation_tool.json Adds the 7 new fields to all 9 test fixture entries, using 0 for the boolean flags and null for optional string fields. Consistent with the rest of the test dataset structure.

Reviews (3): Last reviewed commit: "fix: review changes" | Re-trigger Greptile

@Priyal208
Copy link
Copy Markdown
Member Author

@greptileai

@Priyal208 Priyal208 marked this pull request as ready for review May 6, 2026 13:02
@Priyal208 Priyal208 requested review from ljain112 May 6, 2026 13:02
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@Priyal208 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 33 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: 56ed930e-3c9f-42d6-b684-acc98df752b4

📥 Commits

Reviewing files that changed from the base of the PR and between 3eac6e9 and ee7fdda.

📒 Files selected for processing (3)
  • india_compliance/gst_india/data/test_purchase_reconciliation_tool.json
  • india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js
  • india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py
📝 Walkthrough

Walkthrough

The purchase reconciliation tool is extended with ITC and IRN-related fields across multiple layers. Test data in test_purchase_reconciliation_tool.json is updated to include eight new fields (cost_center, gstr_1_filled, gstr_3b_filled, irn_gen_date, irn_number, irn_source, itc_availability, reason_itc_unavailability) in reconciled data blocks. Backend logic fetches seven of these fields from GST Inward Supply records and propagates them through the reconciliation process. The user interface adds seven new invoice columns for display. Excel export functionality adds eight new invoice columns with special handling to convert boolean gstr_1_filled and gstr_3b_filled values to "Yes"/"No" format.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 summarizes the main change: adding inward supply fields to document view and Excel export, matching the changeset.
Description check ✅ Passed The description is directly related to the changeset, detailing the specific fields added (GSTR-1/3B status, ITC Availability, e-Invoice details) and the Excel export improvements.
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.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

🧹 Nitpick comments (1)
india_compliance/gst_india/data/test_purchase_reconciliation_tool.json (1)

30-37: ⚡ Quick win

Add at least one test case that exercises non-default values for the new fields.

All test cases across the file use identical defaults (gstr_1_filled: 0, gstr_3b_filled: 0, itc_availability: "Yes", all IRN fields null). The critical path of gstr_1_filled = 1 mapping to "Yes" in the UI/Excel renderer is never exercised, nor is itc_availability with a value other than "Yes". Consider adding a test entry like:

{
    "INWARD_SUPPLY": {
        "bill_no": "BILL-23-00001",
        "gstr_1_filled": 1,
        "gstr_3b_filled": 1,
        "itc_availability": "ITC Available but Ineligible",
        "reason_itc_unavailability": "Others"
    },
    ...
    "RECONCILED_DATA": {
        ...
        "gstr_1_filled": 1,
        "gstr_3b_filled": 1,
        "itc_availability": "ITC Available but Ineligible",
        "reason_itc_unavailability": "Others",
        ...
    }
}

This validates the full data-propagation pipeline for these fields.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 611aed82-8c5c-438f-8656-f309898a866d

📥 Commits

Reviewing files that changed from the base of the PR and between 5db41f6 and 3eac6e9.

📒 Files selected for processing (4)
  • india_compliance/gst_india/data/test_purchase_reconciliation_tool.json
  • india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py
  • india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js
  • india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py

Comment on lines +1170 to +1171
"irn_number": inward_supply.get("irn_number"),
"irn_gen_date": inward_supply.get("irn_gen_date"),
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 | 🟡 Minor | ⚡ Quick win

irn_gen_date will render inconsistently in the Excel export — apply format_date in get_consolidated_data.

bill_date and inward_supply_bill_date receive explicit format_date treatment inside get_consolidated_data before being written to the Excel workbook (producing formatted text strings like "11-12-2023"). irn_gen_date, however, is set here from the raw database value and is never formatted — so it arrives at ExcelExporter as a Python datetime.date object. openpyxl will write it as a date cell with whatever the system's default date number-format is, producing a visually inconsistent Excel report.

🛠️ Proposed fix in get_consolidated_data
         purchase.bill_date = format_date(purchase.bill_date)
         inward_supply.bill_date = format_date(inward_supply.bill_date)

         doc.update(purchase)
         doc.update({f"{prefix}_{key}": value for key, value in inward_supply.items()})
         if doc.supplier_gstin:
             doc.pan = doc.supplier_gstin[2:-3]
+
+        if doc.get("irn_gen_date"):
+            doc.irn_gen_date = format_date(doc.irn_gen_date)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant