-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] shopfoor: Refactor write_destination_on_lines
- Loading branch information
1 parent
b977035
commit 89d6276
Showing
15 changed files
with
75 additions
and
123 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,25 @@ 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): | ||
# when writing the destination on the package level, it writes | ||
# on the moves and move lines | ||
lines_with_package_level = lines.package_level_id.move_line_ids | ||
lines_without_package_level = lines - lines_with_package_level | ||
if lines_with_package_level: | ||
lines_with_package_level.package_level_id.location_dest_id = location_dest | ||
if lines_without_package_level: | ||
lines_without_package_level.location_dest_id = location_dest | ||
|
||
def _unload_package(self, lines): | ||
lines.result_package_id = False | ||
|
||
def set_destination_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 | ||
|
||
|
@@ -266,10 +267,10 @@ def _router_validate_success(self, package_level): | |
return self._response_for_start(message=message, popup=completion_info_popup) | ||
|
||
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_destination_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
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 2024 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_destination_and_unload_lines(self, lines, location_dest, unload=False): | ||
checkout_sync = self._actions_for("checkout.sync") | ||
all_lines = checkout_sync._all_lines_to_lock(lines) | ||
super().set_destination_and_unload_lines(all_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