Skip to content

Commit

Permalink
[MIG] stock_move_forced_lot: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiagoMForgeFlow committed Jan 2, 2025
1 parent 384499f commit c267541
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion stock_move_forced_lot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This module allows you to set a lot_id in a procurement
to force the stock move generated to only reserve the selected lot.
""",
"version": "14.0.1.0.0",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
Expand Down
6 changes: 3 additions & 3 deletions stock_move_forced_lot/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class StockMove(models.Model):
_inherit = "stock.move"

forced_lot_id = fields.Many2one("stock.production.lot")
forced_lot_id = fields.Many2one("stock.lot")

def _get_available_quantity(
self,
Expand All @@ -32,8 +32,8 @@ def _get_available_quantity(
def _update_reserved_quantity(
self,
need,
available_quantity,
location_id,
quant_ids=None,
lot_id=None,
package_id=None,
owner_id=None,
Expand All @@ -43,8 +43,8 @@ def _update_reserved_quantity(
lot_id = self.forced_lot_id
return super()._update_reserved_quantity(
need,
available_quantity,
location_id,
quant_ids=quant_ids,
lot_id=lot_id,
package_id=package_id,
owner_id=owner_id,
Expand Down
4 changes: 2 additions & 2 deletions stock_move_forced_lot/models/stock_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def _get_stock_move_values(
product_id,
product_qty,
product_uom,
location_id,
location_dest_id,
name,
origin,
company_id,
Expand All @@ -22,7 +22,7 @@ def _get_stock_move_values(
product_id,
product_qty,
product_uom,
location_id,
location_dest_id,
name,
origin,
company_id,
Expand Down
12 changes: 5 additions & 7 deletions stock_move_forced_lot/tests/test_stock_move_forced_lot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2022 ForgeFlow S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo.tests import SavepointCase
from odoo.tests.common import TransactionCase


class TestStockMoveForcedLot(SavepointCase):
class TestStockMoveForcedLot(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -15,17 +15,15 @@ def setUpClass(cls):
cls.location2 = cls.env.ref("stock.stock_location_components")
cls.picking_type = cls.env.ref("stock.picking_type_internal")
cls.partner = cls.env["res.partner"].create({"name": "Partner"})
route_auto = cls.env["stock.location.route"].create(
{"name": "Auto Create Group"}
)
route_auto = cls.env["stock.route"].create({"name": "Auto Create Group"})
cls.rule_1 = cls.env["stock.rule"].create(
{
"name": "rule with autocreate",
"route_id": route_auto.id,
"action": "pull_push",
"warehouse_id": cls.warehouse.id,
"picking_type_id": cls.picking_type.id,
"location_id": cls.location1.id,
"location_dest_id": cls.location1.id,
"location_src_id": cls.location2.id,
"partner_address_id": cls.partner.id,
}
Expand All @@ -44,7 +42,7 @@ def test_01_create_procurement_with_fixed_lot(self):
serials = []
for i in range(nb_product_todo):
serials.append(
self.env["stock.production.lot"].create(
self.env["stock.lot"].create(
{
"name": f"lot_consumed_{i}",
"product_id": self.product.id,
Expand Down

0 comments on commit c267541

Please sign in to comment.