diff options
| author | Laurent Smet <las@odoo.com> | 2020-07-23 12:59:14 +0000 |
|---|---|---|
| committer | Laurent Smet <las@odoo.com> | 2020-07-31 07:11:32 +0000 |
| commit | e7c9a482b74c9b73865ffd48e4c9975914954e52 (patch) | |
| tree | 27f9ee6aa2753b4456528da93261c765b813fbc6 | |
| parent | f0a50da53e027ed6305323070625595894d5511c (diff) | |
[IMP] point_of_sale,stock_*: Remove StockAccountTestCommon setup class
If run post_install, this setup class is not necessary.
12 files changed, 41 insertions, 58 deletions
diff --git a/addons/mrp_landed_costs/tests/test_stock_landed_costs_mrp.py b/addons/mrp_landed_costs/tests/test_stock_landed_costs_mrp.py index 6ef491ac4fb..173891f09eb 100644 --- a/addons/mrp_landed_costs/tests/test_stock_landed_costs_mrp.py +++ b/addons/mrp_landed_costs/tests/test_stock_landed_costs_mrp.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from odoo.addons.account.tests.common import AccountTestCommon +from odoo.tests import tagged, Form -from odoo.tests import Form -from odoo.addons.stock_account.tests.common import StockAccountTestCommon - -class TestStockLandedCostsMrp(StockAccountTestCommon): +@tagged('post_install', '-at_install') +class TestStockLandedCostsMrp(AccountTestCommon): @classmethod def setUpClass(cls): diff --git a/addons/point_of_sale/tests/common.py b/addons/point_of_sale/tests/common.py index 21bd1599c7b..75052fe30a3 100644 --- a/addons/point_of_sale/tests/common.py +++ b/addons/point_of_sale/tests/common.py @@ -2,12 +2,13 @@ from random import randint from odoo import fields, tools -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.addons.account.tests.common import AccountTestCommon from odoo.tests.common import SavepointCase, Form -from odoo.tools import float_is_zero +from odoo.tests import tagged -class TestPointOfSaleCommon(StockAccountTestCommon): +@tagged('post_install', '-at_install') +class TestPointOfSaleCommon(AccountTestCommon): @classmethod def setUpClass(cls): @@ -146,7 +147,8 @@ class TestPointOfSaleCommon(StockAccountTestCommon): (invoice_rep_lines | refund_rep_lines).write({'account_id': cls.a_expense.id}) -class TestPoSCommon(StockAccountTestCommon): +@tagged('post_install', '-at_install') +class TestPoSCommon(AccountTestCommon): """ Set common values for different special test cases. The idea is to set up common values here for the tests diff --git a/addons/purchase_stock/tests/test_average_price.py b/addons/purchase_stock/tests/test_average_price.py index 54331946a87..dfce8072b33 100644 --- a/addons/purchase_stock/tests/test_average_price.py +++ b/addons/purchase_stock/tests/test_average_price.py @@ -4,11 +4,12 @@ import time from .common import PurchaseTestCommon -from odoo.addons.stock_account.tests.common import StockAccountTestCommon -from odoo.tests import Form +from odoo.addons.account.tests.common import AccountTestCommon +from odoo.tests import tagged, Form -class TestAveragePrice(PurchaseTestCommon, StockAccountTestCommon): +@tagged('-at_install', 'post_install') +class TestAveragePrice(PurchaseTestCommon, AccountTestCommon): def test_00_average_price(self): """ Testcase for average price computation""" diff --git a/addons/purchase_stock/tests/test_fifo_price.py b/addons/purchase_stock/tests/test_fifo_price.py index 9a0bce37195..109ec95d24c 100644 --- a/addons/purchase_stock/tests/test_fifo_price.py +++ b/addons/purchase_stock/tests/test_fifo_price.py @@ -3,11 +3,12 @@ import time from .common import PurchaseTestCommon -from odoo.addons.stock_account.tests.common import StockAccountTestCommon -from odoo.tests import Form +from odoo.addons.account.tests.common import AccountTestCommon +from odoo.tests import tagged, Form -class TestFifoPrice(PurchaseTestCommon, StockAccountTestCommon): +@tagged('-at_install', 'post_install') +class TestFifoPrice(PurchaseTestCommon, AccountTestCommon): def test_00_test_fifo(self): """ Test product cost price with fifo removal strategy.""" diff --git a/addons/purchase_stock/tests/test_fifo_returns.py b/addons/purchase_stock/tests/test_fifo_returns.py index 14f4edb964d..0e6a0d0b932 100644 --- a/addons/purchase_stock/tests/test_fifo_returns.py +++ b/addons/purchase_stock/tests/test_fifo_returns.py @@ -3,11 +3,12 @@ import time from .common import PurchaseTestCommon -from odoo.tests.common import Form -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.tests import tagged, Form +from odoo.addons.account.tests.common import AccountTestCommon -class TestFifoReturns(PurchaseTestCommon, StockAccountTestCommon): +@tagged('-at_install', 'post_install') +class TestFifoReturns(PurchaseTestCommon, AccountTestCommon): def test_fifo_returns(self): """Test to create product and purchase order to test the FIFO returns of the product""" diff --git a/addons/stock_account/tests/common.py b/addons/stock_account/tests/common.py deleted file mode 100644 index 6eec8bce93c..00000000000 --- a/addons/stock_account/tests/common.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo.addons.account.tests.common import AccountTestCommon - - -class StockAccountTestCommon(AccountTestCommon): - - @classmethod - def setUpClass(cls): - super(StockAccountTestCommon, cls).setUpClass() - - # Properties: Stock valuation account and journal - cls.env['ir.property']._set_default( - 'property_stock_valuation_account_id', - 'product.category', - cls.stk, - cls.env.company, - ) - cls.env['ir.property']._set_default( - 'property_stock_journal', - 'product.category', - cls.miscellaneous_journal, - cls.env.company, - ) diff --git a/addons/stock_account/tests/test_anglo_saxon_valuation_reconciliation_common.py b/addons/stock_account/tests/test_anglo_saxon_valuation_reconciliation_common.py index 63691b48209..067d183fb25 100644 --- a/addons/stock_account/tests/test_anglo_saxon_valuation_reconciliation_common.py +++ b/addons/stock_account/tests/test_anglo_saxon_valuation_reconciliation_common.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. - - -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.addons.account.tests.common import AccountTestCommon +from odoo.tests import tagged from odoo import fields -class ValuationReconciliationTestCommon(StockAccountTestCommon): + +@tagged('-at_install', 'post_install') +class ValuationReconciliationTestCommon(AccountTestCommon): """ Base class for tests checking interim accounts reconciliation works in anglosaxon accounting. It sets up everything we need in the tests, and is extended in both sale_stock and purchase modules to run the 'true' tests. diff --git a/addons/stock_dropshipping/tests/test_lifo_price.py b/addons/stock_dropshipping/tests/test_lifo_price.py index ece6d2b7c03..d4e9440e618 100644 --- a/addons/stock_dropshipping/tests/test_lifo_price.py +++ b/addons/stock_dropshipping/tests/test_lifo_price.py @@ -2,12 +2,12 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, tools -from odoo.addons.stock_account.tests.common import StockAccountTestCommon -from odoo.modules.module import get_module_resource -from odoo.tests import common, Form +from odoo.addons.account.tests.common import AccountTestCommon +from odoo.tests import tagged, common, Form -class TestLifoPrice(StockAccountTestCommon): +@tagged('-at_install', 'post_install') +class TestLifoPrice(AccountTestCommon): def test_lifoprice(self): diff --git a/addons/stock_dropshipping/tests/test_stockvaluation.py b/addons/stock_dropshipping/tests/test_stockvaluation.py index f6988a3b783..9e799f8d0c1 100644 --- a/addons/stock_dropshipping/tests/test_stockvaluation.py +++ b/addons/stock_dropshipping/tests/test_stockvaluation.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.addons.account.tests.common import AccountTestCommon from odoo.tests import Form, tagged + @tagged('post_install', '-at_install') -class TestStockValuation(StockAccountTestCommon): +class TestStockValuation(AccountTestCommon): @classmethod def setUpClass(cls): diff --git a/addons/stock_landed_costs/tests/test_stock_landed_costs.py b/addons/stock_landed_costs/tests/test_stock_landed_costs.py index f07bedd6829..caf452258d6 100644 --- a/addons/stock_landed_costs/tests/test_stock_landed_costs.py +++ b/addons/stock_landed_costs/tests/test_stock_landed_costs.py @@ -2,7 +2,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.addons.stock_landed_costs.tests.common import TestStockLandedCostsCommon -from odoo.addons.stock_account.tests.common import StockAccountTestCommon from odoo.exceptions import ValidationError from odoo.tests import tagged diff --git a/addons/stock_landed_costs/tests/test_stock_landed_costs_rounding.py b/addons/stock_landed_costs/tests/test_stock_landed_costs_rounding.py index 2cfcb7b1b75..5fd0b1d45a8 100644 --- a/addons/stock_landed_costs/tests/test_stock_landed_costs_rounding.py +++ b/addons/stock_landed_costs/tests/test_stock_landed_costs_rounding.py @@ -2,12 +2,12 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.addons.stock_landed_costs.tests.common import TestStockLandedCostsCommon -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.addons.account.tests.common import AccountTestCommon from odoo.tests import tagged @tagged('post_install', '-at_install') -class TestStockLandedCostsRounding(TestStockLandedCostsCommon, StockAccountTestCommon): +class TestStockLandedCostsRounding(TestStockLandedCostsCommon, AccountTestCommon): def test_stock_landed_costs_rounding(self): # In order to test the rounding in landed costs feature of stock, I create 2 landed cost diff --git a/addons/stock_landed_costs/tests/test_stockvaluationlayer.py b/addons/stock_landed_costs/tests/test_stockvaluationlayer.py index 770c05aa274..81dcd1977fd 100644 --- a/addons/stock_landed_costs/tests/test_stockvaluationlayer.py +++ b/addons/stock_landed_costs/tests/test_stockvaluationlayer.py @@ -6,10 +6,10 @@ from odoo.tests import Form, tagged from odoo.addons.stock_account.tests.test_stockvaluationlayer import TestStockValuationCommon from odoo.addons.stock_account.tests.test_stockvaluation import _create_accounting_data -from odoo.addons.stock_account.tests.common import StockAccountTestCommon +from odoo.addons.account.tests.common import AccountTestCommon -class TestStockValuationLCCommon(TestStockValuationCommon, StockAccountTestCommon): +class TestStockValuationLCCommon(TestStockValuationCommon, AccountTestCommon): @classmethod def setUpClass(cls): @@ -78,6 +78,7 @@ class TestStockValuationLCCommon(TestStockValuationCommon, StockAccountTestCommo return lc +@tagged('-at_install', 'post_install') class TestStockValuationLCFIFO(TestStockValuationLCCommon): def setUp(self): super(TestStockValuationLCFIFO, self).setUp() @@ -193,6 +194,7 @@ class TestStockValuationLCFIFO(TestStockValuationLCCommon): self.assertEqual(move2.stock_valuation_layer_ids.value, -115) +@tagged('-at_install', 'post_install') class TestStockValuationLCAVCO(TestStockValuationLCCommon): def setUp(self): super(TestStockValuationLCAVCO, self).setUp() @@ -235,6 +237,7 @@ class TestStockValuationLCAVCO(TestStockValuationLCCommon): self.assertEqual(self.product1.quantity_svl, 19) +@tagged('-at_install', 'post_install') class TestStockValuationLCFIFOVB(TestStockValuationLCCommon): @classmethod def setUpClass(cls): |
