Aman-Mittal opened a new issue, #775:
URL: https://github.com/apache/fineract-backoffice-ui/issues/775

   ## Summary
   
   The Working Capital loan product form sets only `accountingRule`. It never 
captures the GL accounts that the rule posts to. A product saved with an 
accrual or cash rule therefore has no portfolio, income, write-off or 
fund-source accounts configured from this UI. Accounting for the product has to 
be fixed through the API before any transaction can post correctly.
   
   ## Evidence (`main` @ `8da1086f`)
   
   
`src/app/features/working-capital/loan-products/wc-loan-product-form.component.ts`
 contains `accountingRule` (7 references). It has no `*AccountId` field, no 
`writeOffReasonsToExpenseMappings`, no 
`chargeOffReasonToExpenseAccountMappings`, no 
`paymentChannelToFundSourceMappings` and no payment-allocation section.
   
   ## Platform support
   
   `POST` / `PUT /v1/working-capital-loan-products[/{id}]` accept the following 
(see the Working Capital product constants in `fineract-working-capital-loan`):
   
   - **Asset / liability accounts:**
     - `fundSourceAccountId`, `loanPortfolioAccountId`, 
`transfersInSuspenseAccountId`
     - `receivableFeeAccountId`, `receivablePenaltyAccountId`
     - `overpaymentLiabilityAccountId`, `deferredIncomeLiabilityAccountId`
   - **Income accounts:**
     - `incomeFromFeeAccountId`, `incomeFromPenaltyAccountId`, 
`incomeFromDiscountFeeAccountId`, `incomeFromRecoveryAccountId`
     - `incomeFromChargeOff{Fees,Interest,Penalty}AccountId`
     - `incomeFromGoodwillCredit{Fees,Interest,Penalty}AccountId`
   - **Expense accounts:** `writeOffAccountId`, `chargeOffExpenseAccountId`, 
`chargeOffFraudExpenseAccountId`, `goodwillCreditAccountId`.
   - **Advanced mappings:**
     - `paymentChannelToFundSourceMappings`, `feeToIncomeAccountMappings`, 
`penaltyToIncomeAccountMappings`
     - `chargeOffReasonToExpenseAccountMappings`, 
`writeOffReasonsToExpenseMappings`
   - **Payment allocation rules** (`paymentAllocation`): the order in which a 
repayment settles fees, penalties and principal.
   
   The product template returns the selectable GL account options.
   
   ## Proposed implementation
   
   - Add an **Accounting** section that appears when the rule is not *None*. 
Reuse the shared GL-account select and the advanced-mapping editors already 
used by the regular loan product form (#288 / #289 / #290 / #294). Mark the 
accounts the chosen rule requires as required.
   - Add a **Payment allocation** section using the existing 
`payment-credit-allocation-editor`.
   - Prefill both sections on edit, and show them on the product view.
   
   ## RBAC
   
   | Action | Permission code | Typically granted to |
   |---|---|---|
   | View product (incl. mappings) | `READ_WORKINGCAPITALLOANPRODUCT` | product 
managers, accountants, auditors |
   | Create product | `CREATE_WORKINGCAPITALLOANPRODUCT` | product manager |
   | Edit product / mappings | `UPDATE_WORKINGCAPITALLOANPRODUCT` | product 
manager together with finance / accounting |
   | Choose GL accounts | the product payload carries the ids; listing accounts 
needs `READ_GLACCOUNT` | accountant |
   
   The GL account picker loads `/glaccounts`. A user who holds 
`UPDATE_WORKINGCAPITALLOANPRODUCT` but not `READ_GLACCOUNT` must get a clear 
message ("you need GL account read access to edit accounting"), not an empty 
select.
   
   ### How Fineract evaluates these permissions
   
   - A write passes with the exact code **or** `ALL_FUNCTIONS`. Reads pass with 
`ALL_FUNCTIONS_READ`.
   - Codes are in `scripts/permission-codes.json`.
   
   ### UI expectations
   
   - Existing routes are already guarded on `CREATE_` / 
`UPDATE_WORKINGCAPITALLOANPRODUCT`. Keep those guards.
   - Gate the accounting section's data load on `READ_GLACCOUNT`.
   
   ## Acceptance criteria
   
   - [ ] An accrual-based Working Capital product can be created with all 
required GL accounts and advanced mappings, and a disbursement and repayment 
then post journal entries.
   - [ ] Payment allocation can be set and is honoured.
   - [ ] Edit prefills every mapping.
   - [ ] The missing-`READ_GLACCOUNT` case is handled clearly.
   - [ ] Unit tests cover the payload for each accounting rule and the prefill.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to