From 3595af3097d8348a0a45ff22189dfaa4e3043836 Mon Sep 17 00:00:00 2001 From: Alex Cuellar Date: Sun, 13 Nov 2022 20:57:12 -0500 Subject: [PATCH] [MIG] stock_move_location: Migration to 16.0 --- stock_move_location/__manifest__.py | 2 +- stock_move_location/models/stock_picking.py | 2 +- stock_move_location/tests/test_common.py | 6 +++--- stock_move_location/tests/test_move_location.py | 8 ++++---- stock_move_location/tests/test_stock_fillwithstock.py | 8 ++++---- stock_move_location/wizard/stock_move_location.py | 2 +- stock_move_location/wizard/stock_move_location.xml | 5 +++-- stock_move_location/wizard/stock_move_location_line.py | 3 +-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/stock_move_location/__manifest__.py b/stock_move_location/__manifest__.py index 9d6bd10c9..4741bca53 100644 --- a/stock_move_location/__manifest__.py +++ b/stock_move_location/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Move Stock Location", - "version": "15.0.1.0.2", + "version": "16.0.1.0.0", "author": "Julius Network Solutions, " "BCIM," "Camptocamp," diff --git a/stock_move_location/models/stock_picking.py b/stock_move_location/models/stock_picking.py index f1f203db3..e0cce3f43 100644 --- a/stock_move_location/models/stock_picking.py +++ b/stock_move_location/models/stock_picking.py @@ -39,7 +39,7 @@ class StockPicking(models.Model): def _validate_picking(self): if self.location_id.child_ids: raise UserError(_("Please choose a source end location")) - if self.move_lines: + if self.move_ids: raise UserError(_("Moves lines already exists")) def _get_movable_quants(self): diff --git a/stock_move_location/tests/test_common.py b/stock_move_location/tests/test_common.py index 65ed28750..797f84d18 100644 --- a/stock_move_location/tests/test_common.py +++ b/stock_move_location/tests/test_common.py @@ -48,21 +48,21 @@ class TestsCommon(common.TransactionCase): cls.product_lots = product_obj.create( {"name": "Apple", "type": "product", "tracking": "lot"} ) - cls.lot1 = cls.env["stock.production.lot"].create( + cls.lot1 = cls.env["stock.lot"].create( { "name": "lot1", "product_id": cls.product_lots.id, "company_id": cls.company.id, } ) - cls.lot2 = cls.env["stock.production.lot"].create( + cls.lot2 = cls.env["stock.lot"].create( { "name": "lot2", "product_id": cls.product_lots.id, "company_id": cls.company.id, } ) - cls.lot3 = cls.env["stock.production.lot"].create( + cls.lot3 = cls.env["stock.lot"].create( { "name": "lot3", "product_id": cls.product_lots.id, diff --git a/stock_move_location/tests/test_move_location.py b/stock_move_location/tests/test_move_location.py index 0a08a0f1d..cc94fcb85 100644 --- a/stock_move_location/tests/test_move_location.py +++ b/stock_move_location/tests/test_move_location.py @@ -98,7 +98,7 @@ class TestMoveLocation(TestsCommon): self.assertEqual(picking.state, "assigned") self.assertEqual(len(picking.move_line_ids), 4) self.assertEqual( - sorted(picking.move_line_ids.mapped("product_uom_qty")), [1, 1, 1, 123] + sorted(picking.move_line_ids.mapped("reserved_uom_qty")), [1, 1, 1, 123] ) def test_quant_transfer(self): @@ -192,7 +192,7 @@ class TestMoveLocation(TestsCommon): wizard = self._create_wizard(wh_stock_shelf_1, wh_stock_shelf_2) wizard.onchange_origin_location() wizard.action_move_location() - self.assertEqual(delivery_picking.state, "assigned") + self.assertEqual(delivery_picking.state, "confirmed") # Do a planned transfer to move quantities to other location # without using module's wizard @@ -217,7 +217,7 @@ class TestMoveLocation(TestsCommon): internal_picking.action_confirm() internal_picking.action_assign() internal_picking.move_line_ids.qty_done = ( - internal_picking.move_line_ids.product_uom_qty + internal_picking.move_line_ids.reserved_uom_qty ) internal_picking.button_validate() self.assertEqual(internal_picking.state, "done") @@ -226,5 +226,5 @@ class TestMoveLocation(TestsCommon): self.assertEqual(delivery_picking.state, "assigned") # The old reserved quantities must be in new location after confirm wizard self.assertEqual(len(delivery_move.move_line_ids), 1) - self.assertEqual(delivery_move.move_line_ids.product_uom_qty, 20.0) + self.assertEqual(delivery_move.move_line_ids.reserved_uom_qty, 20.0) self.assertEqual(delivery_move.move_line_ids.location_id, wh_stock_shelf_3) diff --git a/stock_move_location/tests/test_stock_fillwithstock.py b/stock_move_location/tests/test_stock_fillwithstock.py index c6b6d4845..9a3360046 100644 --- a/stock_move_location/tests/test_stock_fillwithstock.py +++ b/stock_move_location/tests/test_stock_fillwithstock.py @@ -72,18 +72,18 @@ class TestFillwithStock(common.TransactionCase): "picking_type_id": self.env.ref("stock.picking_type_internal").id, } ) - self.assertFalse(picking_stock_pack.move_lines) + self.assertFalse(picking_stock_pack.move_ids) picking_stock_pack.button_fillwithstock() # picking filled with quants in bin - self.assertEqual(len(picking_stock_pack.move_lines), 2) + self.assertEqual(len(picking_stock_pack.move_ids), 2) self.assertEqual( - picking_stock_pack.move_lines.filtered( + picking_stock_pack.move_ids.filtered( lambda m: m.product_id == self.product1 ).product_uom_qty, 10.0, ) self.assertEqual( - picking_stock_pack.move_lines.filtered( + picking_stock_pack.move_ids.filtered( lambda m: m.product_id == self.product2 ).product_uom_qty, 5.0, diff --git a/stock_move_location/wizard/stock_move_location.py b/stock_move_location/wizard/stock_move_location.py index 264fd4b7b..4bd7e2601 100644 --- a/stock_move_location/wizard/stock_move_location.py +++ b/stock_move_location/wizard/stock_move_location.py @@ -230,7 +230,7 @@ class StockMoveLocationWizard(models.TransientModel): ("product_id", "=", line.product_id.id), ("location_id", "=", line.origin_location_id.id), ("lot_id", "=", line.lot_id.id), - ("product_uom_qty", ">", 0.0), + ("qty_done", ">", 0.0), ] ) moves_to_unreserve = move_lines.mapped("move_id") diff --git a/stock_move_location/wizard/stock_move_location.xml b/stock_move_location/wizard/stock_move_location.xml index d0306dd9a..63a36b791 100644 --- a/stock_move_location/wizard/stock_move_location.xml +++ b/stock_move_location/wizard/stock_move_location.xml @@ -12,8 +12,8 @@
+ Edit Locations +
@@ -43,6 +43,7 @@ nolabel="1" widget="one2many_list" mode="tree,kanban" + colspan="2" >