Skip to content

Commit

Permalink
[MIG] stock_picking_procure_method: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
micheledic committed Sep 21, 2023
1 parent a868e97 commit 4308fe3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion stock_picking_procure_method/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Stock Picking Procure Method",
"summary": "Allows to force the procurement method from the picking",
"version": "14.0.1.0.0",
"version": "16.0.0.0.0",
"category": "Warehouse",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
Expand Down
6 changes: 3 additions & 3 deletions stock_picking_procure_method/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def _selection_procure_method(self):
"procure_method"
]["selection"]

@api.depends("move_lines.procure_method")
@api.depends("move_ids.procure_method")
def _compute_procure_method(self):
for picking in self:
procure_method = False
for move in picking.move_lines:
for move in picking.move_ids:
if not procure_method:
procure_method = move.procure_method
elif procure_method != move.procure_method:
Expand All @@ -39,6 +39,6 @@ def _compute_procure_method(self):
picking.procure_method = procure_method

def _inverse_procure_method(self):
self.filtered("procure_method").mapped("move_lines").update(
self.filtered("procure_method").mapped("move_ids").update(
{"procure_method": self.procure_method}
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def setUpClass(cls):
"location_src_id": cls.wh1.lot_stock_id.id,
"procure_method": "make_to_stock",
"picking_type_id": cls.wh1.int_type_id.id,
"location_id": cls.wh2.lot_stock_id.id,
"location_dest_id": cls.wh2.lot_stock_id.id,
"warehouse_id": cls.wh2.id,
"group_propagation_option": "propagate",
"propagate_cancel": True,
Expand Down Expand Up @@ -73,4 +73,4 @@ def test_compute_procure_method(self):
self.assertFalse(self.picking.procure_method)
# We set the procure method in the picking
self.picking.procure_method = "make_to_order"
self.assertEqual(self.picking.move_lines[1].procure_method, "make_to_order")
self.assertEqual(self.picking.move_ids[1].procure_method, "make_to_order")

0 comments on commit 4308fe3

Please sign in to comment.