def test_invoice_id_new_invoice_prepare_invoice(self):
        """ It should prepare invoice from sale order if not existing """
        with mock.patch.object(self.unit, 'binder_for') as mk:
            with mock.patch.object(self.unit.session, 'env') as env:
                env['account.invoice'].search.return_value = []
                prep = mk().to_odoo().sale_line_id.order_id._prepare_invoice
                prep.side_effect = EndTestException
                with self.assertRaises(EndTestException):
                    self.unit.invoice_id(self.record)