fix: add attachment support for all transaction types

Fixed attachments not showing in edit forms for various transaction types by:

1. Adding @InjectAttachable() decorator to models:
   - SaleReceipt, SaleEstimate, CreditNote, PaymentReceived
   - Bill, BillPayment, VendorCredit
   - ManualJournal, Expense

2. Fixing transformers to include attachments in API responses:
   - SaleReceiptTransformer, PaymentReceivedTransformer

3. Registering missing event subscribers in Attachment.module.ts:
   - AttachmentsOnSaleReceipts, AttachmentsOnSaleEstimates

4. Fixing DocumentLink model relation mapping:
   - Changed Document.default to Document for proper module export

5. Fixing PaymentReceived model_ref consistency:
   - Changed from 'PaymentReceive' to 'PaymentReceived' to match class name

6. Adding missing withGraphFetched('attachments') to GetPaymentReceived.service.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ahmed Bouhuolia
2026-02-26 23:16:12 +02:00
parent 6991ec7780
commit 3575d54efa
15 changed files with 55 additions and 17 deletions

View File

@@ -139,22 +139,22 @@ export class SaleReceiptTransformer extends Transformer {
};
/**
* Retrieves the entries of the credit note.
* @param {ISaleReceipt} credit
* Retrieves the entries of the sale receipt.
* @param {ISaleReceipt} receipt
* @returns {}
*/
// protected entries = (receipt: SaleReceipt) => {
// return this.item(receipt.entries, new ItemEntryTransformer(), {
// currencyCode: receipt.currencyCode,
// });
// };
protected entries = (receipt: SaleReceipt) => {
return this.item(receipt.entries, new ItemEntryTransformer(), {
currencyCode: receipt.currencyCode,
});
};
/**
* Retrieves the sale receipt attachments.
* @param {SaleReceipt} receipt
* @returns
*/
// protected attachments = (receipt: SaleReceipt) => {
// return this.item(receipt.attachments, new AttachmentTransformer());
// };
protected attachments = (receipt: SaleReceipt) => {
return this.item(receipt.attachments, new AttachmentTransformer());
};
}