[MIG] stock_move_location: Migration to 16.0

This commit is contained in:
Alex Cuellar
2022-11-13 20:57:12 -05:00
parent db72806225
commit 3595af3097
8 changed files with 18 additions and 18 deletions

View File

@@ -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,"

View File

@@ -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):

View File

@@ -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,

View File

@@ -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)

View File

@@ -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,

View File

@@ -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")

View File

@@ -12,8 +12,8 @@
<div class="oe_button_box" name="button_box" />
<div>
<label for="edit_locations">
Edit Locations
</label>
Edit Locations
</label>
<field name="edit_locations" widget="boolean_toggle" />
</div>
<div groups="stock.group_stock_multi_locations">
@@ -43,6 +43,7 @@
nolabel="1"
widget="one2many_list"
mode="tree,kanban"
colspan="2"
>
<tree
editable="bottom"

View File

@@ -32,7 +32,7 @@ class StockMoveLocationWizardLine(models.TransientModel):
)
lot_id = fields.Many2one(
string="Lot/Serial Number",
comodel_name="stock.production.lot",
comodel_name="stock.lot",
domain="[('product_id','=',product_id)]",
)
move_quantity = fields.Float(
@@ -96,7 +96,6 @@ class StockMoveLocationWizardLine(models.TransientModel):
"lot_id": self.lot_id.id,
"location_id": self.origin_location_id.id,
"location_dest_id": location_dest_id,
"product_uom_qty": qty_todo,
"qty_done": qty_done,
"product_uom_id": self.product_uom_id.id,
"picking_id": picking.id,