Skip to content

Commit

Permalink
[16.0][MIG] Migrate stock_picking_operation_quick_change to v16
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-dacosta committed Feb 23, 2023
1 parent 1fc7b23 commit a73cf49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion stock_picking_operation_quick_change/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Stock Picking Operation Quick Change",
"summary": "Change location of all picking operations",
"version": "15.0.1.1.0",
"version": "16.0.1.0.0",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def default_get(self, fields):
def _default_old_dest_location_id(self):
stock_picking_obj = self.env["stock.picking"]
pickings = stock_picking_obj.browse(self.env.context["active_ids"])
first_move_line = pickings.mapped("move_line_ids")[:1]
first_move_line = pickings.move_line_ids[:1]
return first_move_line.location_dest_id.id

def _get_allowed_locations(self):
Expand Down Expand Up @@ -74,9 +74,7 @@ def _get_allowed_picking_states(self):
@api.depends("picking_id")
def _compute_allowed_product_ids(self):
for record in self:
record.allowed_product_ids = record.picking_id.move_lines.mapped(
"product_id"
)
record.allowed_product_ids = record.picking_id.move_ids.product_id

def check_allowed_pickings(self, pickings):
forbidden_pickings = pickings.filtered(
Expand All @@ -91,7 +89,7 @@ def check_allowed_pickings(self, pickings):
% ",".join(self._get_allowed_picking_states())
)
pickings_with_chained_moves = pickings.filtered(
lambda x: x.move_lines.mapped("move_dest_ids")
lambda x: x.move_ids.move_dest_ids
)
if pickings_with_chained_moves:
raise UserError(
Expand All @@ -105,7 +103,7 @@ def action_apply(self):
stock_picking_obj = self.env["stock.picking"]
pickings = stock_picking_obj.browse(self.env.context["active_ids"])
self.check_allowed_pickings(pickings)
move_lines = pickings.mapped("move_line_ids")
move_lines = pickings.move_line_ids

vals = {"location_dest_id": self.new_location_dest_id.id}
if self.change_all:
Expand Down

0 comments on commit a73cf49

Please sign in to comment.