we will put a sample fix, so in our case we need to made something like that, in case anyone try to use the event triggers for invoice.add, all invoices edited with the event Invoices.Add will end with no delivery method set .
// preserve the actual status
$vars['status'] = $invoice->status;
// Preserve the delivery method (in case of unsent invoice)
if (!empty($invoice->delivery)) {
foreach ($invoice->delivery as $key => $value) {
$vars['delivery'][] = ['method' => $value];
}
}
$this->Invoices->edit($invoice->id, $vars);