fix: edit payment transaction

This commit is contained in:
Ahmed Bouhuolia
2025-10-29 12:54:12 +02:00
parent 98401b5a01
commit fc89cfb14a
13 changed files with 57 additions and 77 deletions

View File

@@ -28,7 +28,12 @@ export class GetBankRulesTransformer extends Transformer {
* @returns {string}
*/
protected assignCategoryFormatted(bankRule: any) {
return getCashflowTransactionFormattedType(bankRule.assignCategory);
const translationKey = getCashflowTransactionFormattedType(
bankRule.assignCategory,
);
return translationKey
? this.context.i18n.t(translationKey)
: bankRule.assignCategory;
}
/**

View File

@@ -19,7 +19,7 @@ export class BillPaymentsPages {
@Inject(BillPayment.name)
private readonly billPaymentModel: TenantModelProxy<typeof BillPayment>,
) {}
) { }
/**
* Retrieve bill payment with associated metadata.
@@ -46,7 +46,8 @@ export class BillPaymentsPages {
paymentAmount: entry.paymentAmount,
}));
const resPayableBills = await Bill.query()
const resPayableBills = await this.billModel()
.query()
.modify('opened')
.modify('dueBills')
.where('vendor_id', billPayment.vendorId)

View File

@@ -18,7 +18,7 @@ export class PaymentsReceivedPagesService {
@Inject(PaymentReceived.name)
private readonly paymentReceived: TenantModelProxy<typeof PaymentReceived>,
) {}
) { }
/**
* Retrive page invoices entries from the given sale invoices models.
@@ -58,11 +58,10 @@ export class PaymentsReceivedPagesService {
/**
* Retrieve the payment receive details of the given id.
* @param {number} tenantId - Tenant id.
* @param {Integer} paymentReceiveId - Payment receive id.
* @param {number} paymentReceiveId - Payment receive id.
*/
public async getPaymentReceiveEditPage(paymentReceiveId: number): Promise<{
paymentReceive: Omit<PaymentReceived, 'entries'>;
data: Omit<PaymentReceived, 'entries'>;
entries: IPaymentReceivePageEntry[];
}> {
// Retrieve payment receive.
@@ -100,7 +99,7 @@ export class PaymentsReceivedPagesService {
const entries = [...paymentEntries, ...restReceivableEntries];
return {
paymentReceive: omit(paymentReceive, ['entries']),
data: omit(paymentReceive, ['entries']),
entries,
};
}