invoice: Allow to always VOID a Draft invoice. See
The restrictions we have introduced to disable VOIDing an invoice with credit generation or reapair items
should not apply for a Draft Invoice.
@@ -772,8 +772,10 @@ public class DefaultInvoiceUserApi implements InvoiceUserApi {
final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(invoiceId, ObjectType.INVOICE, context);
final InvoiceModelDao rawInvoice = dao.getById(invoiceId, internalCallContext);
+ if (rawInvoice.getStatus() == InvoiceStatus.COMMITTED) {
checkInvoiceNotRepaired(rawInvoice);
checkInvoiceDoesContainGeneratedCredit(rawInvoice);
+ }
final Invoice currentInvoice = new DefaultInvoice(rawInvoice, getCatalogSafelyForPrettyNames(internalCallContext));
checkInvoiceNotPaid(currentInvoice);
