fix(rd-products): save RD Interest Paid under expenses, as on FD and savings

The backend finds the account by name in any group. Products saved while it was under liabilities are still read from there, so the name is not left behind as an "other" liability row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 10:48:37 +05:30
co-authored by Claude Sonnet 5.5
parent 1daa8e60a0
commit f804d356d7
@@ -175,18 +175,13 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
if (this.isCashOrAccrualAccounting()) { if (this.isCashOrAccrualAccounting()) {
const glMappings = mappings.otherGlMappingsMap || mappings.otherGlMappings; const glMappings = mappings.otherGlMappingsMap || mappings.otherGlMappings;
this.setOtherGlMappings('assetsOtherGlMappings', glMappings?.assets || [], this.assetAccountOptions); this.setOtherGlMappings('assetsOtherGlMappings', glMappings?.assets || [], this.assetAccountOptions);
// Interest Paid is a liability clearing account (Dr Payable / Cr Paid, then Dr Paid / Cr RD), saved under // Interest Paid sits under expenses, as on the fixed deposit and savings products (the backend finds it by name
// liabilities. Products saved before that kept it under expenses, so both groups are read. // in any group). Products saved while it was under liabilities are read from there too, so the name is not
const fromLiabilities = this.extractNamedGlMapping( // left behind as an "other" liability row; a liability GL chosen then has to be picked again from expenses.
this.extractNamedGlMapping( const fromLiabilities = (glMappings?.liabilities || []).filter(
glMappings?.liabilities || [], (mapping: any) =>
RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME, mapping?.accountName !== RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME &&
'savingsInterestPaidAccountId', mapping?.accountName !== SAVINGS_INTEREST_PAID_ACCOUNT_NAME
this.liabilityAccountOptions
),
SAVINGS_INTEREST_PAID_ACCOUNT_NAME,
'savingsInterestPaidAccountId',
this.liabilityAccountOptions
); );
this.setOtherGlMappings('liabilitiesOtherGlMappings', fromLiabilities, this.liabilityAccountOptions); this.setOtherGlMappings('liabilitiesOtherGlMappings', fromLiabilities, this.liabilityAccountOptions);
const fromExpenses = this.extractNamedGlMapping( const fromExpenses = this.extractNamedGlMapping(
@@ -277,15 +272,15 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
const otherGlMappings = { const otherGlMappings = {
assets: map('assetsOtherGlMappings', this.assetAccountOptions), assets: map('assetsOtherGlMappings', this.assetAccountOptions),
liabilities: [ liabilities: map('liabilitiesOtherGlMappings', this.liabilityAccountOptions),
expenses: [
...namedAsOtherGlMapping( ...namedAsOtherGlMapping(
'savingsInterestPaidAccountId', 'savingsInterestPaidAccountId',
RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME, RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME,
this.liabilityAccountOptions this.expenseAccountOptions
), ),
...map('liabilitiesOtherGlMappings', this.liabilityAccountOptions) ...map('expensesOtherGlMappings', this.expenseAccountOptions)
], ],
expenses: map('expensesOtherGlMappings', this.expenseAccountOptions),
income: map('incomeOtherGlMappings', this.incomeAccountOptions) income: map('incomeOtherGlMappings', this.incomeAccountOptions)
}; };
return Object.values(otherGlMappings).some((v) => v.length) ? otherGlMappings : null; return Object.values(otherGlMappings).some((v) => v.length) ? otherGlMappings : null;
@@ -393,7 +388,8 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
}, },
// Offered on cash as well as accrual: the interest credited at maturity or premature closure is routed // Offered on cash as well as accrual: the interest credited at maturity or premature closure is routed
// Dr Interest On Recurring Deposits / Cr Payable, Dr Payable / Cr Interest Paid, Dr Interest Paid / Cr // Dr Interest On Recurring Deposits / Cr Payable, Dr Payable / Cr Interest Paid, Dr Interest Paid / Cr
// the RD. Optional - a product naming neither posts straight to the control account as before. // the RD. Optional - a product naming neither posts straight to the control account as before. Interest
// Paid itself is under Expenses.
{ {
key: 'interestPayableAccountId', key: 'interestPayableAccountId',
label: 'Interest Payable Account', label: 'Interest Payable Account',
@@ -401,13 +397,6 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
controlName: 'interestPayableAccountId', controlName: 'interestPayableAccountId',
options: this.liabilityAccountOptions options: this.liabilityAccountOptions
}, },
{
key: 'savingsInterestPaidAccountId',
label: 'Recurring Deposit Interest Paid',
inputLabel: 'Recurring deposit interest paid',
controlName: 'savingsInterestPaidAccountId',
options: this.liabilityAccountOptions
},
{ {
key: 'escheatLiabilityId', key: 'escheatLiabilityId',
label: 'Escheat Liability Account', label: 'Escheat Liability Account',
@@ -433,6 +422,13 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
controlName: 'interestOnSavingsAccountId', controlName: 'interestOnSavingsAccountId',
options: this.expenseAccountOptions, options: this.expenseAccountOptions,
required: true required: true
},
{
key: 'savingsInterestPaidAccountId',
label: 'Recurring Deposit Interest Paid',
inputLabel: 'Recurring deposit interest paid',
controlName: 'savingsInterestPaidAccountId',
options: this.expenseAccountOptions
} }
], ],
otherMappingsControlName: 'expensesOtherGlMappings', otherMappingsControlName: 'expensesOtherGlMappings',