diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/stock/tests/common2.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/stock/tests/common2.py')
| -rw-r--r-- | addons/stock/tests/common2.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/addons/stock/tests/common2.py b/addons/stock/tests/common2.py new file mode 100644 index 00000000..3f3c9db2 --- /dev/null +++ b/addons/stock/tests/common2.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +from odoo.addons.mail.tests.common import mail_new_test_user +from odoo.addons.product.tests import common + + +class TestStockCommon(common.TestProductCommon): + + def _create_move(self, product, src_location, dst_location, **values): + # TDE FIXME: user as parameter + Move = self.env['stock.move'].with_user(self.user_stock_manager) + # simulate create + onchange + move = Move.new({'product_id': product.id, 'location_id': src_location.id, 'location_dest_id': dst_location.id}) + move.onchange_product_id() + move_values = move._convert_to_write(move._cache) + move_values.update(**values) + return Move.create(move_values) + + @classmethod + def setUpClass(cls): + super(TestStockCommon, cls).setUpClass() + + # User Data: stock user and stock manager + cls.user_stock_user = mail_new_test_user( + cls.env, + name='Pauline Poivraisselle', + login='pauline', + email='p.p@example.com', + notification_type='inbox', + groups='stock.group_stock_user', + ) + cls.user_stock_manager = mail_new_test_user( + cls.env, + name='Julie Tablier', + login='julie', + email='j.j@example.com', + notification_type='inbox', + groups='stock.group_stock_manager', + ) + + # Warehouses + cls.warehouse_1 = cls.env['stock.warehouse'].create({ + 'name': 'Base Warehouse', + 'reception_steps': 'one_step', + 'delivery_steps': 'ship_only', + 'code': 'BWH'}) + + # Locations + cls.location_1 = cls.env['stock.location'].create({ + 'name': 'TestLocation1', + 'posx': 3, + 'location_id': cls.warehouse_1.lot_stock_id.id, + }) + + # Existing data + cls.existing_inventories = cls.env['stock.inventory'].search([]) + cls.existing_quants = cls.env['stock.quant'].search([]) |
