Skip to content

Cannot batch-print invoices from the orders grid #5639

Closed
@JacobDrummond

Description

@JacobDrummond

Steps to reproduce

  1. Install Magento 2.1.0.
  2. Place some orders, and generate some invoices
  3. Verify that the invoices have been generated in Admin > Sales > Operations > Invoices:
    1
  4. Try to batch-print these invoices in Sales > Orders:
    2

Expected result

  1. Invoice Collection rendered as PDF

Actual result

  1. "There are no printable documents related to selected orders":
    3

Problem

  1. The $collection argument passed to Magento\Sales\Controller\Adminhtml\Order\Pdfinvoices::massAction() is an instance of Magento\Sales\Model\ResourceModel\Order\Invoice\Collection.
  2. The line
    $invoicesCollection = $this->collectionFactory->create()->setOrderFilter(['in' => $collection->getAllIds()]); filters $invoicesCollection with setOrderFilter() using a an array of invoice IDs, not order IDs
  3. Apparently it should be $invoicesCollection = $this->collectionFactory->create()->addAttributeToFilter('entity_id', ['in' => $collection->getAllIds()]);.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions