I wrote a module that adds a mass action for creating invoices and shipments from the invoice. This gets done by calling the URL ./sales_order/finishorder (calls the finish_order function.
After finishing creating the invoices and shipments I wanted to redirect to pdfinvoices to directly print the PDFs for the orders. I tried this using
$this->_redirect('*/*/pdfinvoices');
or
$this->_redirect('*/*/*/pdfinvoices');
but neither will work: The first one just leads back to the order grid, the second one displays a blank page.
I think the second one is correct but the required POST parameters are missing. Is there a way to redirect them to sales_order/pdfinvoices?
Best Answer
The first line in
pdfinvoices
is:Thus it is expecting an array list of order ids to work on.
Make sure your mass action variable is called
order_ids
. If you then forward to thepdfinvoice
action, it will use the same order ids you just worked on.If, for some reason you need to eliminate any ids from the list, (could not process shipping as an example), build a new array of allowed order ids.
Then just before you
_forward
, inject the order ids you want to process into the post variable.