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

@@ -40,6 +40,9 @@ export default class SaleReceiptInventoryTransactionsSubscriber {
saleReceipt,
trx,
}: ISaleReceiptCreatedPayload) => {
// Can't continue if the sale receipt is not closed yet.
if (!saleReceipt.closedAt) return null;
await this.saleReceiptInventory.recordInventoryTransactions(
tenantId,
saleReceipt,
@@ -57,6 +60,9 @@ export default class SaleReceiptInventoryTransactionsSubscriber {
saleReceipt,
trx,
}: ISaleReceiptEditedPayload) => {
// Can't continue if the sale receipt is not closed yet.
if (!saleReceipt.closedAt) return null;
await this.saleReceiptInventory.recordInventoryTransactions(
tenantId,
saleReceipt,