fix(server): shouldn't write GL entries when save transaction as draft.

This commit is contained in:
Ahmed Bouhuolia
2023-08-16 23:05:39 +02:00
parent 01f7effc71
commit 5b2be2ac19
16 changed files with 122 additions and 18 deletions

View File

@@ -58,12 +58,12 @@ export class CloseSaleReceipt {
} as ISaleReceiptEventClosingPayload);
// Mark the sale receipt as closed on the storage.
const saleReceipt = await SaleReceipt.query(trx)
.findById(saleReceiptId)
.patch({
const saleReceipt = await SaleReceipt.query(trx).patchAndFetchById(
saleReceiptId,
{
closedAt: moment().toMySqlDateTime(),
});
}
);
// Triggers `onSaleReceiptClosed` event.
await this.eventPublisher.emitAsync(events.saleReceipt.onClosed, {
saleReceiptId,