code: private function isShipmentAmountInvoiced(Invoice\InvoiceInterface $invoice)
      {
          /** @var Invoice\InvoiceSubjectInterface $sale */
          $sale = $invoice->getSale();
  
          // Abort if another invoice has a shipment line
          foreach ($sale->getInvoices() as $i) {
              if ($i === $invoice) {
                  continue;
              }
              if ($i->hasLineByType(Document\DocumentLineTypes::TYPE_SHIPMENT)) {
                  return true;
              }
          }
  
          return false;
      }
docs: Returns whether the shipment amount is already invoiced.
  
  @param Invoice\InvoiceInterface $invoice
  
  @return bool