[MERGE] stock: pass tests without demodata

Do not require the demo data to be able to run (and pass) the tests of stock.

task-2024202

closes odoo/odoo#34258

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Robot Odoo
2019-07-11 22:50:14 +02:00
committed by GitHub
11 changed files with 154 additions and 66 deletions
+7
View File
@@ -315,6 +315,13 @@ class TestInventory(SavepointCase):
""" Check inventory lines product quantity is 0 when inventory is
started with `prefill_counted_quantity` disable.
"""
self.env['stock.quant'].create({
'product_id': self.product1.id,
'product_uom_id': self.uom_unit.id,
'location_id': self.stock_location.id,
'quantity': 7,
'reserved_quantity': 0,
})
inventory_form = Form(self.env['stock.inventory'].with_context(
default_prefill_counted_quantity=False,
), view='stock.view_inventory_form')
+12 -12
View File
@@ -715,7 +715,7 @@ class StockMove(SavepointCase):
})
# putaway from stock to shelf1
putaway = self.env['stock.putaway.rule'].create({
'product_id': self.env.ref('product.product_product_5').id,
'product_id': self.product.id,
'location_in_id': self.stock_location.id,
'location_out_id': shelf1_location.id,
})
@@ -728,7 +728,7 @@ class StockMove(SavepointCase):
'name': 'test_putaway_2',
'location_id': self.supplier_location.id,
'location_dest_id': self.stock_location.id,
'product_id': self.env.ref('product.product_product_5').id,
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'product_uom_qty': 100.0,
})
@@ -766,7 +766,7 @@ class StockMove(SavepointCase):
'location_out_id': shelf1_location.id,
})
putaway_product = self.env['stock.putaway.rule'].create({
'product_id': self.env.ref('stock.product_cable_management_box').id,
'product_id': self.product.id,
'location_in_id': self.supplier_location.id,
'location_out_id': shelf2_location.id,
})
@@ -782,8 +782,8 @@ class StockMove(SavepointCase):
'name': 'test_putaway_3',
'location_id': self.supplier_location.id,
'location_dest_id': self.stock_location.id,
'product_id': self.env.ref('stock.product_cable_management_box').id,
'product_uom': self.env.ref('uom.product_uom_kgm').id,
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'product_uom_qty': 100.0,
})
move1._action_confirm()
@@ -822,7 +822,7 @@ class StockMove(SavepointCase):
'location_out_id': shelf1_location.id,
})
putaway_product = self.env['stock.putaway.rule'].create({
'product_id': self.env.ref('stock.product_cable_management_box').id,
'product_id': self.product_consu.id,
'location_in_id': self.stock_location.id,
'location_out_id': shelf2_location.id,
})
@@ -876,14 +876,13 @@ class StockMove(SavepointCase):
putaway.id,
])],
})
# creation
move1 = self.env['stock.move'].create({
'name': 'test_putaway_5',
'location_id': self.supplier_location.id,
'location_dest_id': self.stock_location.id,
'product_id': self.env.ref('stock.product_cable_management_box').id,
'product_uom': self.env.ref('uom.product_uom_kgm').id,
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'product_uom_qty': 100.0,
})
move1._action_confirm()
@@ -920,7 +919,7 @@ class StockMove(SavepointCase):
'location_out_id': shelf1_location.id,
})
putaway_category_office_furn = self.env['stock.putaway.rule'].create({
'category_id': self.env.ref('product.product_category_5').id,
'category_id': self.ref('product.product_category_all'),
'location_in_id': self.supplier_location.id,
'location_out_id': shelf2_location.id,
})
@@ -930,14 +929,15 @@ class StockMove(SavepointCase):
putaway_category_office_furn.id,
])],
})
self.product.categ_id = self.ref('product.product_category_all')
# creation
move1 = self.env['stock.move'].create({
'name': 'test_putaway_6',
'location_id': self.supplier_location.id,
'location_dest_id': self.stock_location.id,
'product_id': self.env.ref('stock.product_cable_management_box').id,
'product_uom': self.env.ref('uom.product_uom_kgm').id,
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'product_uom_qty': 100.0,
})
move1._action_confirm()
+5 -4
View File
@@ -1892,6 +1892,7 @@ class TestRoutes(TestStockCommon):
'categ_id': self.env.ref('product.product_category_all').id,
})
self.uom_unit = self.env.ref('uom.product_uom_unit')
self.partner = self.env['res.partner'].create({'name': 'Partner'})
def _enable_pick_ship(self):
self.wh = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.id)], limit=1)
@@ -2040,7 +2041,7 @@ class TestRoutes(TestStockCommon):
"""
warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.id)], limit=1)
warehouse.delivery_steps = 'pick_pack_ship'
partner_demo_customer = self.env.ref('base.res_partner_1')
partner_demo_customer = self.partner
final_location = partner_demo_customer.property_stock_customer
product_a = self.env['product.product'].create({
'name': 'ProductA',
@@ -2098,7 +2099,7 @@ class TestRoutes(TestStockCommon):
"""
warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.id)], limit=1)
warehouse.delivery_steps = 'pick_pack_ship'
partner_demo_customer = self.env.ref('base.res_partner_1')
partner_demo_customer = self.partner
final_location = partner_demo_customer.property_stock_customer
product_a = self.env['product.product'].create({
'name': 'ProductA',
@@ -2144,7 +2145,7 @@ class TestRoutes(TestStockCommon):
"""
warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.id)], limit=1)
warehouse.delivery_steps = 'pick_pack_ship'
partner_demo_customer = self.env.ref('base.res_partner_1')
partner_demo_customer = self.partner
final_location = partner_demo_customer.property_stock_customer
product_a = self.env['product.product'].create({
'name': 'ProductA',
@@ -2237,7 +2238,7 @@ class TestRoutes(TestStockCommon):
"""
warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.company.id)], limit=1)
warehouse.delivery_steps = 'pick_pack_ship'
partner_demo_customer = self.env.ref('base.res_partner_1')
partner_demo_customer = self.partner
final_location = partner_demo_customer.property_stock_customer
product_a = self.env['product.product'].create({
'name': 'ProductA',
+13 -4
View File
@@ -7,6 +7,15 @@ from odoo.tests.common import TransactionCase
class TestPackingNeg(TransactionCase):
def test_packing_neg(self):
res_partner_2 = self.env['res.partner'].create({
'name': 'Deco Addict',
'email': 'deco.addict82@example.com',
})
res_partner_4 = self.env['res.partner'].create({
'name': 'Ready Mat',
'email': 'ready.mat28@example.com',
})
# Create a new "negative" storable product
product_neg = self.env['product.product'].create({
@@ -17,7 +26,7 @@ class TestPackingNeg(TransactionCase):
'standard_price': 70.0,
'seller_ids': [(0, 0, {
'delay': 1,
'name': self.ref('base.res_partner_2'),
'name': res_partner_2.id,
'min_qty': 2.0,})],
'uom_id': self.ref('uom.product_uom_unit'),
'uom_po_id': self.ref('uom.product_uom_unit'),
@@ -26,7 +35,7 @@ class TestPackingNeg(TransactionCase):
# Create an incoming picking for this product of 300 PCE from suppliers to stock
vals = {
'name': 'Incoming picking (negative product)',
'partner_id': self.ref('base.res_partner_2'),
'partner_id': res_partner_2.id,
'picking_type_id': self.ref('stock.picking_type_in'),
'location_id': self.ref('stock.stock_location_suppliers'),
'location_dest_id': self.ref('stock.stock_location_stock'),
@@ -83,7 +92,7 @@ class TestPackingNeg(TransactionCase):
# Make a delivery order of 300 pieces to the customer
vals = {
'name': 'outgoing picking (negative product)',
'partner_id': self.ref('base.res_partner_4'),
'partner_id': res_partner_4.id,
'picking_type_id': self.ref('stock.picking_type_out'),
'location_id': self.ref('stock.stock_location_stock'),
'location_dest_id': self.ref('stock.stock_location_customers'),
@@ -140,7 +149,7 @@ class TestPackingNeg(TransactionCase):
# Create a picking for reconciling the negative quant
vals = {
'name': 'reconciling_delivery',
'partner_id': self.ref('base.res_partner_4'),
'partner_id': res_partner_4.id,
'picking_type_id': self.ref('stock.picking_type_in'),
'location_id': self.ref('stock.stock_location_suppliers'),
'location_dest_id': self.ref('stock.stock_location_stock'),
+26 -16
View File
@@ -9,6 +9,16 @@ from odoo.tools import mute_logger
class TestProcRule(TransactionCase):
def setUp(self):
super(TestProcRule, self).setUp()
self.uom_unit = self.env.ref('uom.product_uom_unit')
self.product = self.env['product.product'].create({
'name': 'Desk Combination',
'type': 'consu',
})
self.partner = self.env['res.partner'].create({'name': 'Partner'})
def test_proc_rule(self):
# Create a product route containing a stock rule that will
# generate a move from Stock for every procurement created in Output
@@ -25,14 +35,14 @@ class TestProcRule(TransactionCase):
})
# Set this route on `product.product_product_3`
self.env.ref('product.product_product_3').write({
self.product.write({
'route_ids': [(4, product_route.id)]})
# Create Delivery Order of 10 `product.product_product_3` from Output -> Customer
product = self.env.ref('product.product_product_3')
product = self.product
vals = {
'name': 'Delivery order for procurement',
'partner_id': self.ref('base.res_partner_2'),
'partner_id': self.partner.id,
'picking_type_id': self.ref('stock.picking_type_out'),
'location_id': self.ref('stock.stock_location_output'),
'location_dest_id': self.ref('stock.stock_location_customers'),
@@ -60,7 +70,7 @@ class TestProcRule(TransactionCase):
# Check that a picking was created from stock to output.
moves = self.env['stock.move'].search([
('product_id', '=', self.ref('product.product_product_3')),
('product_id', '=', self.product.id),
('location_id', '=', self.ref('stock.stock_location_stock')),
('location_dest_id', '=', self.ref('stock.stock_location_output')),
('move_dest_ids', 'in', [pick_output.move_lines[0].id])
@@ -70,16 +80,16 @@ class TestProcRule(TransactionCase):
def test_rule_propagate_1(self):
move_dest = self.env['stock.move'].create({
'name': 'move_dest',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'location_id': self.ref('stock.stock_location_output'),
'location_dest_id': self.ref('stock.stock_location_customers'),
})
move_orig = self.env['stock.move'].create({
'name': 'move_orig',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'move_dest_ids': [(4, move_dest.id)],
'propagate_date': True,
'propagate_date_minimum_delta': 5,
@@ -102,16 +112,16 @@ class TestProcRule(TransactionCase):
def test_rule_propagate_2(self):
move_dest = self.env['stock.move'].create({
'name': 'move_dest',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'location_id': self.ref('stock.stock_location_output'),
'location_dest_id': self.ref('stock.stock_location_customers'),
})
move_orig = self.env['stock.move'].create({
'name': 'move_orig',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'move_dest_ids': [(4, move_dest.id)],
'propagate_date': False,
'propagate_date_minimum_delta': 5,
@@ -132,16 +142,16 @@ class TestProcRule(TransactionCase):
def test_rule_propagate_3(self):
move_dest = self.env['stock.move'].create({
'name': 'move_dest',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'location_id': self.ref('stock.stock_location_output'),
'location_dest_id': self.ref('stock.stock_location_customers'),
})
move_orig = self.env['stock.move'].create({
'name': 'move_orig',
'product_id': self.ref('product.product_product_3'),
'product_uom': self.ref('uom.product_uom_unit'),
'product_id': self.product.id,
'product_uom': self.uom_unit.id,
'move_dest_ids': [(4, move_dest.id)],
'propagate_date': True,
'propagate_date_minimum_delta': 5,
+24 -5
View File
@@ -47,7 +47,15 @@ class StockQuant(SavepointCase):
'type': 'product',
'tracking': 'serial',
})
cls.stock_location = cls.env.ref('stock.stock_location_stock')
cls.stock_location = cls.env['stock.location'].create({
'name': 'stock_location',
'usage': 'internal',
})
cls.stock_subloc2 = cls.env['stock.location'].create({
'name': 'subloc2',
'usage': 'internal',
'location_id': cls.stock_location.id,
})
def gather_relevant(self, product_id, location_id, lot_id=None, package_id=None, owner_id=None, strict=False):
quants = self.env['stock.quant']._gather(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=strict)
@@ -163,7 +171,7 @@ class StockQuant(SavepointCase):
'location_id': self.stock_location.id,
'quantity': 1.0,
})
self.env = self.env(user=self.env.ref('base.user_demo'))
self.env = self.env(user=self.demo_user)
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product, self.stock_location), 1.0)
def test_increase_available_quantity_1(self):
@@ -191,6 +199,8 @@ class StockQuant(SavepointCase):
the reserved quanntity for the same product.
"""
quant = self.env['stock.quant'].search([('location_id', '=', self.stock_location.id)], limit=1)
if not quant:
self.skipTest('Cannot test concurrent transactions without demo data.')
product = quant.product_id
available_quantity = self.env['stock.quant']._get_available_quantity(product, self.stock_location)
# opens a new cursor and SELECT FOR UPDATE the quant, to simulate another concurrent reserved
@@ -207,7 +217,7 @@ class StockQuant(SavepointCase):
def test_increase_available_quantity_4(self):
""" Increase the available quantity when no quants are already in a location with a user without access right.
"""
self.env = self.env(user=self.env.ref('base.user_demo'))
self.env = self.env(user=self.demo_user)
self.env['stock.quant']._update_available_quantity(self.product, self.stock_location, 1.0)
def test_increase_available_quantity_5(self):
@@ -246,6 +256,7 @@ class StockQuant(SavepointCase):
""" Setting a location's usage as "view" should be forbidden if it already
contains quant.
"""
self.env['stock.quant']._update_available_quantity(self.product, self.stock_location, 1.0)
self.assertTrue(len(self.stock_location.quant_ids.ids) > 0)
with self.assertRaises(UserError):
self.stock_location.usage = 'view'
@@ -277,6 +288,8 @@ class StockQuant(SavepointCase):
the reserved quanntity for the same product.
"""
quant = self.env['stock.quant'].search([('location_id', '=', self.stock_location.id)], limit=1)
if not quant:
self.skipTest('Cannot test concurrent transactions without demo data.')
product = quant.product_id
available_quantity = self.env['stock.quant']._get_available_quantity(product, self.stock_location)
@@ -579,8 +592,14 @@ class StockQuant(SavepointCase):
def test_in_date_4b(self):
""" Check for LIFO and max with/without in_date that it handles the LIFO NULLS LAST well
"""
stock_location1 = self.env.ref('stock.stock_location_components')
stock_location2 = self.env.ref('stock.stock_location_14')
stock_location1 = self.env['stock.location'].create({
'name': 'Shelf 1',
'location_id': self.stock_location.id
})
stock_location2 = self.env['stock.location'].create({
'name': 'Shelf 2',
'location_id': self.stock_location.id
})
lifo_strategy = self.env['product.removal'].search([('method', '=', 'lifo')])
self.stock_location.removal_strategy_id = lifo_strategy
@@ -197,7 +197,12 @@ class TestEditableQuant(SavepointCase):
""" Try to edit a record without the inventory mode.
Must raise an error.
"""
user_demo = self.env.ref('base.user_demo')
self.demo_user = self.env['res.users'].with_context({'no_reset_password': True, 'mail_create_nosubscribe': True}).create({
'name': 'Pauline Poivraisselle',
'login': 'pauline',
'email': 'p.p@example.com',
'groups_id': [(6, 0, [self.env.ref('base.group_user').id])]
})
user_admin = self.env.ref('base.user_admin')
quant = self.Quant.create({
'product_id': self.product.id,
@@ -207,7 +212,7 @@ class TestEditableQuant(SavepointCase):
self.assertEqual(quant.quantity, 12)
# Try to write on quant without permission
with self.assertRaises(AccessError):
quant.with_user(user_demo).write({'inventory_quantity': 8})
quant.with_user(self.demo_user).write({'inventory_quantity': 8})
self.assertEqual(quant.quantity, 12)
# Try to write on quant with permission
+13 -2
View File
@@ -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)]})
@@ -7,10 +7,15 @@ class TestStockLocationSearch(common.TransactionCase):
def setUp(self):
super(TestStockLocationSearch, self).setUp()
self.location = self.env['stock.location']
self.location_barcode = self.env.ref('stock.stock_location_14')
self.location_barcode_id = self.location_barcode.id
self.barcode = self.location_barcode.barcode
self.name = self.location_barcode.name
self.stock_location = self.env.ref('stock.stock_location_stock')
self.sublocation = self.env['stock.location'].create({
'name': 'Shelf 2',
'barcode': 1201985,
'location_id': self.stock_location.id
})
self.location_barcode_id = self.sublocation.id
self.barcode = self.sublocation.barcode
self.name = self.sublocation.name
def test_10_location_search_by_barcode(self):
"""Search stock location by barcode"""
+11 -6
View File
@@ -6,6 +6,11 @@ from odoo.exceptions import AccessError
class TestWarehouse(TestStockCommon):
def setUp(self):
super(TestWarehouse, self).setUp()
self.partner = self.env['res.partner'].create({'name': 'Deco Addict'})
def test_inventory_product(self):
self.product_1.type = 'product'
product_1_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({
@@ -90,7 +95,7 @@ class TestWarehouse(TestStockCommon):
product = self.product_3.with_user(self.user_stock_manager)
product.type = 'product'
picking_out = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': self.warehouse_1.lot_stock_id.id,
'location_dest_id': self.env.ref('stock.stock_location_customers').id,
@@ -151,7 +156,7 @@ class TestWarehouse(TestStockCommon):
# Create a picking out and force availability
picking_out = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': stock_location.id,
'location_dest_id': customer_location.id,
@@ -194,7 +199,7 @@ class TestWarehouse(TestStockCommon):
# Create a picking out and force availability
picking_out = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': stock_location.id,
'location_dest_id': customer_location.id,
@@ -279,7 +284,7 @@ class TestWarehouse(TestStockCommon):
})
picking_out = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': warehouse_shop.lot_stock_id.id,
'location_dest_id': self.env.ref('stock.stock_location_customers').id,
@@ -359,7 +364,7 @@ class TestWarehouse(TestStockCommon):
# Create the move for the shop Namur. Should create a resupply from
# distribution warehouse Namur.
picking_out_namur = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': warehouse_shop_namur.lot_stock_id.id,
'location_dest_id': customer_location.id,
@@ -403,7 +408,7 @@ class TestWarehouse(TestStockCommon):
# Create the move for the shop Wavre. Should create a resupply from
# distribution warehouse Wavre.
picking_out_wavre = self.env['stock.picking'].create({
'partner_id': self.env.ref('base.res_partner_2').id,
'partner_id': self.partner.id,
'picking_type_id': self.env.ref('stock.picking_type_out').id,
'location_id': warehouse_shop_wavre.lot_stock_id.id,
'location_dest_id': customer_location.id,
+27 -11
View File
@@ -17,10 +17,26 @@ class TestWiseOperator(TransactionCase):
'uom_po_id': self.ref('uom.product_uom_unit'),
})
self.partner = self.env['res.partner'].create({'name': 'Deco Addict'})
warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.company.id)], limit=1)
self.shelf2 = self.env['stock.location'].create({
'name': 'Shelf 2',
'barcode': 1231985,
'location_id': warehouse.lot_stock_id.id
})
self.shelf1 = self.env['stock.location'].create({
'name': 'Shelf 1',
'barcode': 1231892,
'location_id': warehouse.lot_stock_id.id
})
self.partner2 = self.env['res.partner'].create({'name': 'Ready Mat'})
# Create an incoming picking for this product of 10 PCE from suppliers to stock
vals = {
'name': 'Incoming picking (wise unit)',
'partner_id': self.ref('base.res_partner_2'),
'partner_id': self.partner.id,
'picking_type_id': self.ref('stock.picking_type_in'),
'location_id': self.ref('stock.stock_location_suppliers'),
'location_dest_id': self.ref('stock.stock_location_stock'),
@@ -46,7 +62,7 @@ class TestWiseOperator(TransactionCase):
pick1_wise.move_line_ids[0].write({
'result_package_id': package1.id,
'qty_done': 4,
'location_dest_id': self.ref('stock.stock_location_components')
'location_dest_id': self.shelf1.id
})
new_pack1 = self.env['stock.move.line'].create({
'product_id': product_wise.id,
@@ -54,7 +70,7 @@ class TestWiseOperator(TransactionCase):
'picking_id': pick1_wise.id,
'qty_done': 6.0,
'location_id': self.ref('stock.stock_location_suppliers'),
'location_dest_id': self.ref('stock.stock_location_14')
'location_dest_id': self.shelf2.id
})
# Transfer the receipt
@@ -67,7 +83,7 @@ class TestWiseOperator(TransactionCase):
# Make a delivery order of 5 pieces to the customer
vals = {
'name': 'outgoing picking 1 (wise unit)',
'partner_id': self.ref('base.res_partner_4'),
'partner_id': self.partner2.id,
'picking_type_id': self.ref('stock.picking_type_out'),
'location_id': self.ref('stock.stock_location_stock'),
'location_dest_id': self.ref('stock.stock_location_customers'),
@@ -92,7 +108,7 @@ class TestWiseOperator(TransactionCase):
# Make a delivery order of 5 pieces to the customer
vals = {
'name': 'outgoing picking 2 (wise unit)',
'partner_id': self.ref('base.res_partner_4'),
'partner_id': self.partner2.id,
'picking_type_id': self.ref('stock.picking_type_out'),
'location_id': self.ref('stock.stock_location_stock'),
'location_dest_id': self.ref('stock.stock_location_customers'),
@@ -121,10 +137,10 @@ class TestWiseOperator(TransactionCase):
pack_ids1 = delivery_order_wise1.move_line_ids
pack_ids2 = delivery_order_wise2.move_line_ids
self.assertEqual(pack_ids1.location_id.id, self.ref('stock.stock_location_14'))
self.assertEqual(pack_ids1.location_id.id, self.shelf2.id)
self.assertEqual(set(pack_ids2.mapped('location_id.id')), set([
self.ref('stock.stock_location_components'),
self.ref('stock.stock_location_14')]))
self.shelf1.id,
self.shelf2.id]))
# put the move lines from delivery_order_wise2 into delivery_order_wise1
for pack_id2 in pack_ids2:
@@ -136,8 +152,8 @@ class TestWiseOperator(TransactionCase):
self.assertEqual(sum(new_move_lines.mapped('product_qty')), 0)
self.assertEqual(sum(new_move_lines.mapped('qty_done')), 5)
self.assertEqual(set(new_move_lines.mapped('location_id.id')), set([
self.ref('stock.stock_location_components'),
self.ref('stock.stock_location_14')]))
self.shelf1.id,
self.shelf2.id]))
# put the move line from delivery_order_wise1 into delivery_order_wise2
new_pack_id2 = pack_ids1.copy(default={'picking_id': delivery_order_wise2.id, 'move_id': move2.id})
@@ -148,7 +164,7 @@ class TestWiseOperator(TransactionCase):
self.assertEqual(len(new_move_lines), 1)
self.assertEqual(sum(new_move_lines.mapped('product_qty')), 0)
self.assertEqual(sum(new_move_lines.mapped('qty_done')), 5)
self.assertEqual(new_move_lines.location_id.id, self.ref('stock.stock_location_14'))
self.assertEqual(new_move_lines.location_id.id, self.shelf2.id)
# Process this picking
delivery_order_wise1.action_done()