Files
stock-logistics-warehouse/stock_location_tray/tests/common.py
Guewen Baconnier 78f6847f29 Add stock_location_tray
Extracted from stock_vertical_lift
(https://github.com/OCA/stock-logistics-warehouse/pull/633)

Add tray types to stock locations, automatically generates
sub-locations. Present them nicely with a custom widget.
2020-03-17 10:56:01 +01:00

40 lines
1.3 KiB
Python

# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
class LocationTrayTypeCase(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.stock_location = cls.env.ref('stock.stock_location_stock')
cls.product = cls.env.ref(
'product.product_delivery_02'
)
cls.tray_location = cls.env.ref(
"stock_location_tray.stock_location_tray_demo"
)
cls.tray_type_small_8x = cls.env.ref(
'stock_location_tray.stock_location_tray_type_small_8x'
)
cls.tray_type_small_32x = cls.env.ref(
'stock_location_tray.stock_location_tray_type_small_32x'
)
def _cell_for(self, tray, x=1, y=1):
cell = self.env['stock.location'].search(
[('location_id', '=', tray.id), ('posx', '=', x), ('posy', '=', y)]
)
self.assertEqual(
len(cell),
1,
"Cell x{}y{} not found for {}".format(x, y, tray.name),
)
return cell
def _update_quantity_in_cell(self, cell, product, quantity):
self.env['stock.quant']._update_available_quantity(
product, cell, quantity
)