diff --git a/src/controllers/09-debit-note-controller.ts b/src/controllers/09-debit-note-controller.ts index 8c817aa..36fa432 100644 --- a/src/controllers/09-debit-note-controller.ts +++ b/src/controllers/09-debit-note-controller.ts @@ -843,7 +843,11 @@ export class DebitNoteActionController extends Controller { @Post("accept") @Security("keycloak", MANAGE_ROLES) async acceptDebitNote(@Request() req: RequestWithUser, @Path() debitNoteId: string) { - await this.#checkPermission(req.user, debitNoteId); + const record = await this.#checkPermission(req.user, debitNoteId); + + if (record.quotationStatus !== QuotationStatus.Issued) { + throw new HttpError(HttpStatus.BAD_REQUEST, "Already Accepted", "debitNoteAlreadyAccept"); + } return await prisma.quotation.update({ where: { id: debitNoteId }, data: { quotationStatus: QuotationStatus.Accepted },