Sheinvest Patches

Custom fixes for Frappe Lending V16 Beta — Sheinvest

Install Sheinvest Patches

bench get-app https://github.com/Jotho98/sheinvest-patches

Add the Frappe Gems badge to your README

Maintain Sheinvest Patches? Paste this into your README:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=Jotho98%2Fsheinvest-patches)](https://frappegems.com/gems/apps/Jotho98/sheinvest-patches)

About Sheinvest Patches

SheInvest Patches

SheInvest Advance Payment EMI classification

For a SheInvest Advance Payment replacement schedule, repayment_start_date is anchored to the first financial contractual row. This preserves residual fixed contractual Interest as ordinary EMI Interest, including a row whose Principal has been fully consumed FIFO. It prevents native Lending from mistaking such a row for Broken Period Interest merely because the row has zero Principal and falls before a later repayment start date.

The change does not override Loan Demand generation, BPI constructor logic, GL construction, repayment allocation, accounting, cancellation, or reversal. Genuine native BPI behavior outside SheInvest Advance Payment replacement schedules is unchanged.

Compatibility extensions for the deployed Frappe Lending v16 environment.

Advance Payment architecture

Native Lending owns Loan Repayment submission, allocations, Loan Restructure, Loan Repayment Schedule submission, Loan Demands, GL entries, settlement, cancellation, and reversal.

SheInvest supplies only its contractual rules:

  • contractual Interest is consumed FIFO using Loan Repayment.total_interest_paid;
  • native effective-date Interest uses only Loan Repayment.unbooked_interest_paid;
  • principal is consumed FIFO using native outstanding-principal values;
  • the immediately prior Active schedule is the contractual baseline;
  • surviving installments retain their original dates;
  • maturity is never extended;
  • a zero-value effective-date peg accommodates native Lending's borrowed-row behavior;
  • native Lending marks and links that peg normally, while financial contractual rows remain undemanded until their EMI dates;
  • retained contractual Interest is anchored to the first financial row so native Lending classifies it as EMI Interest rather than BPI.

No Advance Payment demand cancellation, future-demand rebuilding, provenance guard, duplicate-demand repair, or destructive post-restructure reconciliation is included.

Issue B: source-linked demand cancellation

Native Loan Repayment cancellation restores allocations represented by repayment_details. A native excess-principal demand may instead be linked directly through Loan Demand.loan_repayment and remain submitted after its source repayment is cancelled.

The Loan Repayment.on_cancel compatibility hook delegates to Lending's native reverse_demands() helper with the exact cancelled Loan Repayment name, Loan, value date, and Loan Disbursement. It therefore reverses only submitted demands that directly identify that cancelled repayment.

The hook does not query, match, cancel, rebuild, or repair unrelated demands. It contains no repayment names, demand names, or transaction-specific amounts.

Scheduled demands

Scheduled EMI demand generation remains entirely native. SheInvest does not run the Process Loan Demand job synchronously from Loan Restructure events. Normal midnight scheduler execution or manual execution of the native job is expected.

Contractual interest accrual ceiling

Invalid Regular SheInvest accruals are skipped at the native Loan Interest Accrual constructor boundary, before a document is created. This includes inverted fragments, zero-interest schedule rows, and contractual rows whose interest is already fully accrued. Explicit Repayment accruals remain native so legitimate unbooked interest is preserved. The validation hook never sets an instantiated Loan Interest Accrual to zero.

Other retained compatibility behavior

  • historical posting-date preservation;
  • charge invoice and charge-allocation handling;
  • bank reconciliation integration based on bank_reconciliation_tool_v056.js;
  • exact zero-day native Advance Payment accrual guard;
  • source-document accounting-date alignment;
  • Bank Transaction unreconciliation when a linked Lending voucher is cancelled.

Deployment

After uploading the repository, run the normal application migration and cache refresh process for the site. Previously submitted business documents are not modified by migration or by this release. Existing affected documents can be handled through normal UI cancellation and amendment workflows.

Native borrowed-row behavior

The zero-value effective-date peg is the sole compatibility mechanism for native Advance Payment demand provenance. Native Lending may call set_demand() on the peg and link effective-date Interest and Principal demands to it. SheInvest does not compare settlement amounts to the peg, suppress set_demand(), or remove the repayment_schedule_detail link. Genuine contractual rows remain available for ordinary scheduled EMI demand generation.

The prior Fix 13 source transformation has been removed. The independent zero-day accrual guard remains narrowly scoped to the native zero-denominator expression.

Related Accounting apps for Frappe & ERPNext

  • Books — Free Accounting Software
  • Lending — Open Source Lending software
  • Payments — A payments app for frappe
  • Banking — Load your bank transactions into ERPNext and reconcile them with your vouchers.
  • Erpnext Quota — App to manage ERPNext Site, User, Company and Space limitations
  • Utility Billing — The Utility Billing & Property Management App is a powerful addition to ERPNext, designed to streamline utility billing, property leasing, and tenant management. Ideal for municipal utilities, real estate managers, and property developers.
  • Expense Request — ERPNext Expense Requests
  • Vendor Payments — A frappe app that has workflows and reports to make payments to vendors by a company and track them