Skip to content

Commit a6269e2

Browse files
committed
Merge PR OCA#1201 into 16.0
Signed-off-by pedrobaeza
2 parents d87cdf3 + f6b7865 commit a6269e2

File tree

6 files changed

+62
-2
lines changed

6 files changed

+62
-2
lines changed

contract/tests/test_contract.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,28 @@
1212

1313
from odoo import fields
1414
from odoo.exceptions import UserError, ValidationError
15-
from odoo.tests import Form, common
15+
from odoo.tests import Form, common, tagged
1616

1717

1818
def to_date(date):
1919
return fields.Date.to_date(date)
2020

2121

22+
@tagged("post_install", "-at_install")
2223
class TestContractBase(common.TransactionCase):
2324
@classmethod
2425
def setUpClass(cls):
2526
super().setUpClass()
27+
if not cls.env.company.chart_template_id:
28+
# Load a CoA if there's none in current company
29+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
30+
if not coa:
31+
# Load the first available CoA
32+
coa = cls.env["account.chart.template"].search(
33+
[("visible", "=", True)], limit=1
34+
)
35+
coa.try_loading(company=cls.env.company, install_demo=False)
36+
2637
cls.today = fields.Date.today()
2738
cls.pricelist = cls.env["product.pricelist"].create(
2839
{"name": "pricelist for contract test"}
@@ -2329,6 +2340,7 @@ def test_terminate_date_before_last_date_invoiced(self):
23292340
to_date("2018-02-13"),
23302341
)
23312342

2343+
@freeze_time("2020-01-01")
23322344
def test_recurrency_propagation(self):
23332345
# Existing contract
23342346
vals = {

contract_payment_mode/tests/test_contract_payment.py

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ class TestContractPaymentInit(odoo.tests.HttpCase):
1919
@classmethod
2020
def setUpClass(cls):
2121
super().setUpClass()
22+
if not cls.env.company.chart_template_id:
23+
# Load a CoA if there's none in current company
24+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
25+
if not coa:
26+
# Load the first available CoA
27+
coa = cls.env["account.chart.template"].search(
28+
[("visible", "=", True)], limit=1
29+
)
30+
coa.try_loading(company=cls.env.company, install_demo=False)
2231

2332
Method_get_payment_method_information = (
2433
AccountPaymentMethod._get_payment_method_information

contract_sale_generation/tests/common.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@
55
from freezegun import freeze_time
66

77
from odoo import fields
8-
from odoo.tests import Form
8+
from odoo.tests import Form, tagged
99

1010

1111
def to_date(date):
1212
return fields.Date.to_date(date)
1313

1414

15+
@tagged("post_install", "-at_install")
1516
class ContractSaleCommon:
1617
# Use case : Prepare some data for current test case
1718

1819
@classmethod
1920
def setUpClass(cls):
2021
super().setUpClass()
22+
if not cls.env.company.chart_template_id:
23+
# Load a CoA if there's none in current company
24+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
25+
if not coa:
26+
# Load the first available CoA
27+
coa = cls.env["account.chart.template"].search(
28+
[("visible", "=", True)], limit=1
29+
)
30+
coa.try_loading(company=cls.env.company, install_demo=False)
2131
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
2232
cls.analytic_account = cls.env["account.analytic.account"].create(
2333
{

contract_variable_quantity/tests/test_contract_variable_quantity.py

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ class TestContractVariableQuantity(TransactionCase):
1414
@classmethod
1515
def setUpClass(cls):
1616
super().setUpClass()
17+
if not cls.env.company.chart_template_id:
18+
# Load a CoA if there's none in current company
19+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
20+
if not coa:
21+
# Load the first available CoA
22+
coa = cls.env["account.chart.template"].search(
23+
[("visible", "=", True)], limit=1
24+
)
25+
coa.try_loading(company=cls.env.company, install_demo=False)
1726
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
1827
cls.product = cls.env["product.product"].create({"name": "Test product"})
1928
cls.contract = cls.env["contract.contract"].create(

product_contract/tests/test_sale_order.py

+11
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
from odoo.exceptions import UserError, ValidationError
88
from odoo.fields import Date
9+
from odoo.tests import tagged
910
from odoo.tests.common import TransactionCase
1011

1112

13+
@tagged("post_install", "-at_install")
1214
class TestSaleOrder(TransactionCase):
1315
@classmethod
1416
def setUpClass(cls):
@@ -20,6 +22,15 @@ def setUpClass(cls):
2022
no_reset_password=True,
2123
)
2224
)
25+
if not cls.env.company.chart_template_id:
26+
# Load a CoA if there's none in current company
27+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
28+
if not coa:
29+
# Load the first available CoA
30+
coa = cls.env["account.chart.template"].search(
31+
[("visible", "=", True)], limit=1
32+
)
33+
coa.try_loading(company=cls.env.company, install_demo=False)
2334
cls.product1 = cls.env.ref("product.product_product_1")
2435
cls.product2 = cls.env.ref("product.product_product_2")
2536
cls.sale = cls.env.ref("sale.sale_order_2")

subscription_oca/tests/test_subscription_oca.py

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ def setUpClass(cls):
1515
super().setUpClass()
1616
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
1717
cls.portal_user = cls.env.ref("base.demo_user0")
18+
if not cls.env.company.chart_template_id:
19+
# Load a CoA if there's none in current company
20+
coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False)
21+
if not coa:
22+
# Load the first available CoA
23+
coa = cls.env["account.chart.template"].search(
24+
[("visible", "=", True)], limit=1
25+
)
26+
coa.try_loading(company=cls.env.company, install_demo=False)
1827
cls.cash_journal = cls.env["account.journal"].search(
1928
[
2029
("type", "=", "cash"),

0 commit comments

Comments
 (0)