mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
@@ -4,3 +4,4 @@
|
||||
* Joan Sisquella <joan.sisquella@forgeflow.com>
|
||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
* Lois Rilo <lois.rilo@forgeflow.com>
|
||||
* Héctor Villarreal <hector.villarreal@forgeflow.com>
|
||||
|
||||
@@ -32,6 +32,15 @@ class TestsCommon(common.SavepointCase):
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
cls.internal_loc_2_shelf = cls.location_obj.create(
|
||||
{
|
||||
"name": "Shelf",
|
||||
"usage": "internal",
|
||||
"active": True,
|
||||
"company_id": cls.company.id,
|
||||
"location_id": cls.internal_loc_2.id,
|
||||
}
|
||||
)
|
||||
cls.uom_unit = cls.env.ref("uom.product_uom_unit")
|
||||
cls.product_no_lots = product_obj.create(
|
||||
{"name": "Pineapple", "type": "product", "tracking": "none"}
|
||||
@@ -94,3 +103,13 @@ class TestsCommon(common.SavepointCase):
|
||||
"destination_location_id": destination_location.id,
|
||||
}
|
||||
)
|
||||
|
||||
def _create_putaway_for_product(self, product, loc_in, loc_out):
|
||||
putaway = self.env["stock.putaway.rule"].create(
|
||||
{
|
||||
"product_id": product.id,
|
||||
"location_in_id": loc_in.id,
|
||||
"location_out_id": loc_out.id,
|
||||
}
|
||||
)
|
||||
loc_in.write({"putaway_rule_ids": [(4, putaway.id, 0)]})
|
||||
|
||||
@@ -117,3 +117,18 @@ class TestMoveLocation(TestsCommon):
|
||||
"""Test that no error is raised from actions."""
|
||||
pick_type = self.env.ref("stock.picking_type_internal")
|
||||
pick_type.action_move_location()
|
||||
|
||||
def test_wizard_with_putaway_strategy(self):
|
||||
"""Test that Putaway strategies are being applied."""
|
||||
self._create_putaway_for_product(
|
||||
self.product_no_lots, self.internal_loc_2, self.internal_loc_2_shelf
|
||||
)
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.apply_putaway_strategy = True
|
||||
wizard.onchange_origin_location()
|
||||
putaway_line = wizard.stock_move_location_line_ids.filtered(
|
||||
lambda p: p.product_id == self.product_no_lots
|
||||
)[0]
|
||||
self.assertEqual(
|
||||
putaway_line.destination_location_id, self.internal_loc_2_shelf
|
||||
)
|
||||
|
||||
@@ -211,7 +211,7 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
# Apply the putaway strategy
|
||||
location_dest_id = (
|
||||
self.apply_putaway_strategy
|
||||
and self.destination_location_id.get_putaway_strategy(product).id
|
||||
and self.destination_location_id._get_putaway_strategy(product).id
|
||||
or self.destination_location_id.id
|
||||
)
|
||||
product_data.append(
|
||||
|
||||
Reference in New Issue
Block a user