def test_invoice_id_search(self):
        """ It should search for invoice from origin """
        with mock.patch.object(self.unit, 'binder_for'):
            with mock.patch.object(self.unit.session, 'env') as env:
                env['account.invoice'].search.side_effect = EndTestException
                proc_id = self.unit.binder_for().to_odoo()
                with self.assertRaises(EndTestException):
                    self.unit.invoice_id(self.record)
                env['account.invoice'].search.assert_called_once_with(
                    [('origin', '=', proc_id.sale_line_id.order_id.name)],
                    limit=1,
                )