* commons & setup refactoring: * convert setUp to setUpClass * move setups where needed (stock/mrp commons or specific test classes) * create test data in batch (faster, less sql queries & batched operations) * move most tests post-install to allow runbot splits * by default, run tests without mail logic * by default, run tests in a consistent environment (fixed currency imposed in the BaseCommon) * refactor existing tests to use new commons data (while trying to keep diff reduced) * add dedicated test file to test the common data * use mute_logger to reduce useless test logs (less spam to scroll in logs, less data on runbot builds, ...) Part-of: odoo/odoo#96791
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.tests import tagged
|
|
|
|
from odoo.addons.product.tests.common import ProductCommon
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestProductCommon(ProductCommon):
|
|
|
|
def test_common(self):
|
|
self.assertEqual(self.consumable_product.type, 'consu')
|
|
self.assertEqual(self.service_product.type, 'service')
|
|
|
|
account_module = self.env['ir.module.module']._get('account')
|
|
if account_module.state == 'installed':
|
|
self.assertFalse(self.consumable_product.taxes_id)
|
|
self.assertFalse(self.service_product.taxes_id)
|
|
|
|
self.assertFalse(self.pricelist.item_ids)
|
|
self.assertEqual(
|
|
self.env['product.pricelist'].search([]),
|
|
self.pricelist,
|
|
)
|
|
self.assertEqual(
|
|
self.env['res.partner'].search([]).property_product_pricelist,
|
|
self.pricelist,
|
|
)
|
|
self.assertEqual(self.pricelist.currency_id.name, 'USD')
|
|
self.assertEqual(self.pricelist.discount_policy, 'with_discount')
|