-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] shopfloor: Refactor _write_destination_on_lines
- Loading branch information
1 parent
5c67bb1
commit f9be0e8
Showing
15 changed files
with
61 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Copyright 2020 Camptocamp SA (http://www.camptocamp.com) | ||
# Copyright 2025 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo import _, fields | ||
from odoo.tools.float_utils import float_round | ||
|
@@ -228,3 +229,21 @@ def no_putaway_available(self, picking_types, move_lines): | |
# when no putaway is found, the move line destination stays the | ||
# default's of the picking type | ||
return any(line.location_dest_id in base_locations for line in move_lines) | ||
|
||
def _lock_lines(self, lines): | ||
self._actions_for("lock").for_update(lines) | ||
|
||
def _set_destination_on_lines( | ||
self, lines, location_dest, unload=False, set_src_location=False | ||
): | ||
lines.package_level_id.location_dest_id = location_dest | ||
lines.location_dest_id = location_dest | ||
|
||
def _unload_package(self, lines): | ||
lines.result_package_id = False | ||
|
||
def set_locations_and_unload_lines(self, lines, location_dest, unload=False): | ||
self._lock_lines(lines) | ||
self._set_destination_on_lines(lines, location_dest) | ||
if unload: | ||
self._unload_package(lines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Copyright 2020-2021 Camptocamp SA (http://www.camptocamp.com) | ||
# Copyright 2020-2021 Jacques-Etienne Baudoux (BCIM) <[email protected]> | ||
# Copyright 2020 Akretion (http://www.akretion.com) | ||
# Copyright 2025 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields | ||
|
||
|
@@ -268,8 +269,10 @@ def _router_validate_success(self, package_level): | |
def _set_destination_and_done(self, package_level, scanned_location): | ||
# when writing the destination on the package level, it writes | ||
# on the move lines | ||
package_level.location_dest_id = scanned_location | ||
stock = self._actions_for("stock") | ||
stock.set_locations_and_unload_lines( | ||
package_level.move_line_ids, scanned_location | ||
) | ||
stock.put_package_level_in_move(package_level) | ||
stock.validate_moves(package_level.move_line_ids.move_id) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from . import actions | ||
from . import services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import checkout_sync | ||
from . import stock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Copyright 2020 Camptocamp SA | ||
# Copyright 2025 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
|
||
from odoo.addons.component.core import Component | ||
|
@@ -27,8 +28,4 @@ def _all_lines_to_lock(self, lines): | |
return lines | ||
|
||
def _sync_checkout(self, lines, location): | ||
moves = lines.mapped("move_id") | ||
if self._has_to_sync_destination(lines): | ||
dest_pickings = moves._moves_to_sync_checkout() | ||
all_moves = self.env["stock.move"].union(*dest_pickings.values()) | ||
all_moves.sync_checkout_destination(location) | ||
lines.move_id.sync_checkout_destination(location) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2025 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.addons.component.core import Component | ||
|
||
|
||
class StockAction(Component): | ||
_inherit = "shopfloor.stock.action" | ||
|
||
def _set_destination_on_lines(self, lines, location_dest): | ||
checkout_sync = self._actions_for("checkout.sync") | ||
checkout_sync._sync_checkout(lines, location_dest) | ||
super()._set_destination_on_lines(lines, location_dest) | ||
|
||
def set_locations_and_unload_lines(self, lines, location_dest, unload=False): | ||
checkout_sync = self._actions_for("checkout.sync") | ||
checkout_sync._all_lines_to_lock(lines) | ||
super().set_locations_and_unload_lines(lines, location_dest, unload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
* Guewen Baconnier <[email protected]> | ||
* `Trobz <https://trobz.com>`_: | ||
* Michael Tietz (MT Software) <[email protected]> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
shopfloor_checkout_sync/services/location_content_transfer.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters