[FIX] Stock Move Location: apply putaway rules

- The function called to get the putaway rule when creating the Move Lines does not exist in odoo.
- Add test to actually commit the Wizard and test the resulting move.lines
This commit is contained in:
Joshua Kreuder
2022-12-08 20:03:23 +01:00
parent 5830833b99
commit e9fb7bfe09
2 changed files with 9 additions and 1 deletions

View File

@@ -156,6 +156,14 @@ class TestMoveLocation(TestsCommon):
putaway_line.destination_location_id, self.internal_loc_2_shelf
)
# Actually commit the wizard and check stock.move.line.location_dest_id
ret = wizard.action_move_location()
picking = self.env["stock.picking"].browse([ret["res_id"]])
putaway_move_line = picking.move_line_ids.filtered(
lambda l: l.product_id == self.product_no_lots
)[0]
self.assertEqual(putaway_move_line.location_dest_id, self.internal_loc_2_shelf)
def test_delivery_order_assignation_after_transfer(self):
"""
Make sure using the wizard doesn't break assignation on delivery orders

View File

@@ -103,7 +103,7 @@ class StockMoveLocationWizardLine(models.TransientModel):
self.ensure_one()
location_dest_id = (
self.move_location_wizard_id.apply_putaway_strategy
and self.destination_location_id.get_putaway_strategy(self.product_id).id
and self.destination_location_id._get_putaway_strategy(self.product_id).id
or self.destination_location_id.id
)
qty_todo, qty_done = self._get_available_quantity()