code: static public function getSaleEditableDocumentTypes(SaleInterface $sale)
      {
          $types = [];
  
          foreach (DocumentTypes::getTypes() as $type) {
              if (!static::isSaleSupportsDocumentType($sale, $type)) {
                  continue;
              }
  
              foreach ($sale->getAttachments() as $attachment) {
                  if ($attachment->getType() === $type) {
                      continue 2;
                  }
              }
  
              $types[] = $type;
          }
  
          return $types;
      }
docs: Returns the types of the sale editable documents.
  
  @param SaleInterface $sale
  
  @return array