I have found that solution for PS 1.5.5:
https://github.com/PrestaShop/PrestaShop/commit/9ff0d601589fdf791a8bd895de187bb45eb7939f
It works in my PS 1.5.4.1 making theese changes in classes\order\OrderHistory.php file:
Arround line 370, replace this:
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`
by this:
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`
And arround line 403, replace this:
if (Validate::isLoadedObject($order))
Mail::Send((int)$order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'].' '.$result['lastname'],
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop);
by this:
if (Validate::isLoadedObject($order))
{
// Join PDF invoice if order state is "payment accepted"
if ((int)$result['id_order_state'] === 2 && (int)Configuration::get('PS_INVOICE') && $order->invoice_number)
{
$context = Context::getContext();
$pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $context->smarty);
$file_attachement['content'] = $pdf->render(false);
$file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';
$file_attachement['mime'] = 'application/pdf';
}
else
$file_attachement = null;
Mail::Send((int)$order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'].' '.$result['lastname'],
null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop);
}
I guess it will not be difficult to adapt these changes to other sub-versions of PS 1.5.