From a90fe83dbaacafddabc444ce61debf60a419a4f1 Mon Sep 17 00:00:00 2001 From: Hetashree Chauhan Date: Wed, 19 Jun 2019 06:30:30 +0000 Subject: [PATCH] [IMP] stock: pass tests without demo data for file test_stock_flow. pass all test cases without any demo data. If a user has not installed any demo data, then also test cases must not be break. task-2024202 closes : https://github.com/odoo/odoo/pull/34258 --- addons/stock/tests/test_stock_flow.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/stock/tests/test_stock_flow.py b/addons/stock/tests/test_stock_flow.py index 0fe521d992c..2b7fb864678 100644 --- a/addons/stock/tests/test_stock_flow.py +++ b/addons/stock/tests/test_stock_flow.py @@ -6,6 +6,17 @@ from odoo.tools import mute_logger, float_round from odoo.exceptions import UserError class TestStockFlow(TestStockCommon): + def setUp(cls): + super(TestStockFlow, cls).setUp() + cls.partner_company2 = cls.env['res.partner'].create({ + 'name': 'My Company (Chicago)-demo', + 'email': 'chicago@yourcompany.com', + }) + cls.company = cls.env['res.company'].create({ + 'currency_id': cls.env.ref('base.USD').id, + 'partner_id': cls.partner_company2.id, + 'name': 'My Company (Chicago)-demo', + }) @mute_logger('odoo.addons.base.models.ir_model', 'odoo.models') def test_00_picking_create_and_transfer_quantity(self): @@ -1806,7 +1817,7 @@ class TestStockFlow(TestStockCommon): self.env.user.write({'groups_id': [(4, grp_multi_routes.id)]}) self.env.user.write({'groups_id': [(4, grp_multi_companies.id)]}) - company_2 = self.env.ref('stock.res_company_1') + company_2 = self.company # Need to add a new company on user. self.env.user.write({'company_ids': [(4, company_2.id)]}) @@ -1870,7 +1881,7 @@ class TestStockFlow(TestStockCommon): self.env.user.write({'groups_id': [(4, grp_multi_routes.id)]}) self.env.user.write({'groups_id': [(4, grp_multi_companies.id)]}) - company_2 = self.env.ref('stock.res_company_1') + company_2 = self.company # Need to add a new company on user. self.env.user.write({'company_ids': [(4, company_2.id)]})