Skip to content

Commit

Permalink
Merge PR OCA#1732 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by jbaudoux
  • Loading branch information
OCA-git-bot committed Sep 30, 2024
2 parents 072694f + 906d617 commit aba1aad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions stock_putaway_by_route/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2020 Camptocamp
# Copyright 2024 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models
Expand All @@ -16,11 +17,18 @@ def _generate_serial_move_line_commands(self, lot_names, origin_move_line=None):
lot_names, origin_move_line=origin_move_line
)

def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
def _get_putaway_routes(self):
routes = self.env["stock.location"]
if self.rule_id.route_id:
self = self.with_context(_putaway_route_id=self.rule_id.route_id)
routes = self.rule_id.route_id
elif self.product_id.route_ids:
self = self.with_context(_putaway_route_id=self.product_id.route_ids)
routes = self.product_id.route_ids
return routes

def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
putaway_routes = self._get_putaway_routes()
if putaway_routes:
self = self.with_context(_putaway_route_id=putaway_routes)
return super()._prepare_move_line_vals(
quantity=quantity, reserved_quant=reserved_quant
)
1 change: 1 addition & 0 deletions stock_putaway_by_route/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
Trobz

* Dung Tran <[email protected]>
* Michael Tietz (MT Software) <[email protected]>

0 comments on commit aba1aad

Please sign in to comment.