[FIX] skip tests if there's no COA

This commit is contained in:
Holger Brunn
2020-04-22 08:09:56 +02:00
parent c48616fbe1
commit 4aaa2bc385
6 changed files with 21 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import unittest
from odoo.tests.common import SavepointCase
@@ -25,6 +26,8 @@ class TestAccountPayment(SavepointCase):
# Journals
cls.bank_journal = cls.account_journal_model.search(
[('type', '=', 'bank')], limit=1)
if not cls.bank_journal:
raise unittest.SkipTest('No journals defined')
cls.bank_journal.inbound_payment_method_ids = [
(6, 0, [cls.inbound_payment_method_01.id,
cls.inbound_payment_method_02.id])]

View File

@@ -1,6 +1,7 @@
# © 2017 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import unittest
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
@@ -10,6 +11,9 @@ class TestPaymentMode(TransactionCase):
def setUp(self):
super(TestPaymentMode, self).setUp()
if not self.env['account.account'].search([]):
raise unittest.SkipTest('No accounts defined')
# Company
self.company = self.env.ref('base.main_company')

View File

@@ -3,6 +3,7 @@
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import unittest
from odoo.tests.common import SavepointCase
from odoo.exceptions import ValidationError, UserError
from datetime import date, timedelta
@@ -24,6 +25,8 @@ class TestPaymentOrderInboundBase(SavepointCase):
'|', ('company_id', '=', cls.env.user.company_id.id),
('company_id', '=', False)], limit=1
)
if not cls.journal:
raise unittest.SkipTest('No journal found')
cls.inbound_mode.variable_journal_ids = cls.journal
# Make sure no others orders are present
cls.domain = [

View File

@@ -1,7 +1,7 @@
# © 2017 Camptocamp SA
# © 2017 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import unittest
from datetime import date, datetime, timedelta
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import SavepointCase
@@ -17,6 +17,8 @@ class TestPaymentOrderOutbound(SavepointCase):
[('user_type_id', '=', cls.env.ref(
'account.data_account_type_expenses').id)],
limit=1).id
if not cls.invoice_line_account:
raise unittest.SkipTest('No account found')
cls.invoice = cls._create_supplier_invoice()
cls.invoice_02 = cls._create_supplier_invoice()
cls.mode = cls.env.ref(

View File

@@ -1,6 +1,7 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
import unittest
from odoo import fields, _
from odoo.tests import common
from odoo.exceptions import ValidationError
@@ -31,8 +32,10 @@ class TestAccountPaymentPartner(common.SavepointCase):
if charts:
cls.chart = charts[0]
else:
raise ValidationError(
cls.tearDownClass()
raise unittest.SkipTest(
_("No Chart of Account Template has been defined !"))
old_company = cls.env.user.company_id
cls.env.user.company_id = cls.company_2.id
cls.chart.try_loading_for_current_company()

View File

@@ -1,6 +1,7 @@
# Copyright 2018 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import unittest
from odoo.tests.common import SavepointCase
@@ -10,6 +11,9 @@ class CommonTestCase(SavepointCase):
def setUpClass(cls):
super().setUpClass()
if not cls.env['account.account'].search([]):
raise unittest.SkipTest('No accounts defined')
cls.bank = cls.env["res.partner.bank"].create({
'acc_number': 'test',
'partner_id': cls.env.user.company_id.partner_id.id,