diff --git a/addons/delivery/tests/test_packing_delivery.py b/addons/delivery/tests/test_packing_delivery.py index 17f4c2edb2524c1b1c28f6f38ba58544171dc693..c40cdb2d500cab02c1254a2075d7df51a1d27c37 100644 --- a/addons/delivery/tests/test_packing_delivery.py +++ b/addons/delivery/tests/test_packing_delivery.py @@ -1,30 +1,34 @@ -from odoo.addons.stock.tests.test_packing import TestPacking +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from odoo.addons.stock.tests.test_packing import TestPackingCommon -class TestPacking(TestPacking): - def setUp(self): - super(TestPacking, self).setUp() - self.uom_kg = self.env.ref('uom.product_uom_kgm') - self.product_aw = self.env['product.product'].create({ +class TestPacking(TestPackingCommon): + + @classmethod + def setUpClass(cls): + super(TestPacking, cls).setUpClass() + cls.uom_kg = cls.env.ref('uom.product_uom_kgm') + cls.product_aw = cls.env['product.product'].create({ 'name': 'Product AW', 'type': 'product', 'weight': 2.4, - 'uom_id': self.uom_kg.id, - 'uom_po_id': self.uom_kg.id + 'uom_id': cls.uom_kg.id, + 'uom_po_id': cls.uom_kg.id }) - self.product_bw = self.env['product.product'].create({ + cls.product_bw = cls.env['product.product'].create({ 'name': 'Product BW', 'type': 'product', 'weight': 0.3, - 'uom_id': self.uom_kg.id, - 'uom_po_id': self.uom_kg.id + 'uom_id': cls.uom_kg.id, + 'uom_po_id': cls.uom_kg.id }) - test_carrier_product = self.env['product.product'].create({ + test_carrier_product = cls.env['product.product'].create({ 'name': 'Test carrier product', 'type': 'service', }) - self.test_carrier = self.env['delivery.carrier'].create({ + cls.test_carrier = cls.env['delivery.carrier'].create({ 'name': 'Test carrier', 'delivery_type': 'fixed', 'product_id': test_carrier_product.id, diff --git a/addons/stock/tests/test_packing.py b/addons/stock/tests/test_packing.py index 440ebac31fc96c38507b5c52889f61d4138b7f4f..fba6bfe24734474137d441dfc5207a793c21c93d 100644 --- a/addons/stock/tests/test_packing.py +++ b/addons/stock/tests/test_packing.py @@ -5,10 +5,11 @@ from odoo.tests.common import SavepointCase from odoo.tools import float_round -class TestPacking(SavepointCase): +class TestPackingCommon(SavepointCase): + @classmethod def setUpClass(cls): - super(TestPacking, cls).setUpClass() + super(TestPackingCommon, cls).setUpClass() cls.stock_location = cls.env.ref('stock.stock_location_stock') cls.warehouse = cls.env['stock.warehouse'].search([('lot_stock_id', '=', cls.stock_location.id)], limit=1) cls.warehouse.write({'delivery_steps': 'pick_pack_ship'}) @@ -19,6 +20,9 @@ class TestPacking(SavepointCase): cls.productA = cls.env['product.product'].create({'name': 'Product A', 'type': 'product'}) cls.productB = cls.env['product.product'].create({'name': 'Product B', 'type': 'product'}) + +class TestPacking(TestPackingCommon): + def test_put_in_pack(self): """ In a pick pack ship scenario, create two packs in pick and check that they are correctly recognised and handled by the pack and ship picking.