-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] shopfloor_single_product_transfer: Package scan
Do not remove result_package_id in call of _set_quantity__by_location when it was previously set by scanning a package
- Loading branch information
1 parent
d775ba2
commit a6e8dfe
Showing
17 changed files
with
75 additions
and
33 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ Shopfloor Single Product Transfer | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:0c02f49273316c190e1d17d298f97dbb41f4bf80e1c5341091bb90fff4c0404f | ||
!! source digest: sha256:6c68d48d21b7dec7174f3018b1d89dac0781c150792d1c3f70adfc7d39052b3a | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
|
@@ -86,6 +86,7 @@ Contributors | |
~~~~~~~~~~~~ | ||
|
||
* Matthieu Méquignon <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
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 @@ | ||
* Matthieu Méquignon <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> |
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 2022 Camptocamp SA | ||
# Copyright 2023 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
import logging | ||
|
@@ -578,7 +579,9 @@ def _valid_dest_location_for_menu(self): | |
domain = self._valid_dest_location_for_menu_domain() | ||
return self.env["stock.location"].search(domain) | ||
|
||
def _set_quantity__check_location(self, move_line, location, confirmation=False): | ||
def _set_quantity__check_location( | ||
self, move_line, location, package=None, confirmation=False | ||
): | ||
valid_locations_for_move_line = ( | ||
self._set_quantity__valid_dest_location_for_move_line(move_line) | ||
) | ||
|
@@ -693,14 +696,26 @@ def _set_quantity__by_location_handlers(self): | |
self._set_quantity__check_location, | ||
] | ||
|
||
def _set_quantity__by_location(self, move_line, location, confirmation=False): | ||
def _set_quantity__by_location( | ||
self, move_line, location, package=None, confirmation=False | ||
): | ||
# We're about to leave the `set_quantity` screen. | ||
# First ensure that quantity is valid. | ||
invalid_qty_response = self._set_quantity__check_quantity_done(move_line) | ||
if invalid_qty_response: | ||
return invalid_qty_response | ||
move_line.result_package_id = False | ||
# Do not remove the result_package_id | ||
# when it was previously set by _set_quantity__by_package | ||
# because _set_quantity__by_location will be then called | ||
# with the scanned empty package | ||
if not package: | ||
move_line.result_package_id = False | ||
handlers = self._set_quantity__by_location_handlers() | ||
# At this point the result_package_id is already | ||
# set by _set_quantity__by_package to scanned package | ||
# or set to False by this method | ||
# Because of this call the handlers without the package | ||
# to ensure the move_line's result_package_id gets checked | ||
response = self._use_handlers( | ||
handlers, move_line, location, confirmation=confirmation | ||
) | ||
|
@@ -721,7 +736,11 @@ def _set_quantity__by_package(self, move_line, package, confirmation=False): | |
location = package.location_id | ||
handlers = self._set_quantity__by_location_handlers() | ||
response = self._use_handlers( | ||
handlers, move_line, location, confirmation=confirmation | ||
handlers, | ||
move_line, | ||
location, | ||
package=package, | ||
confirmation=confirmation, | ||
) | ||
if response: | ||
return response | ||
|
@@ -889,10 +908,10 @@ def set_location(self, selected_line_id, package_id, barcode): | |
} | ||
search = self._actions_for("search") | ||
search_result = search.find(barcode, types=handlers_by_type.keys()) | ||
package = self.env["stock.quant.package"].browse(package_id) | ||
handler = handlers_by_type.get(search_result.type) | ||
if handler: | ||
return handler(move_line, search_result.record) | ||
package = self.env["stock.quant.package"].browse(package_id) | ||
return handler(move_line, search_result.record, package=package) | ||
message = self.msg_store.barcode_not_found() | ||
return self._response_for_set_location(move_line, package, message=message) | ||
|
||
|
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
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ Shopfloor Single Product Transfer Force Select Package | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:5c5fcdf15f9d541770a2f5b6662b44e8d9b213a07ddf924f8030465ffb46aa8f | ||
!! source digest: sha256:e82edcbccff746daa3c4eb6aa9014931e7b70cc699598b4ab2752ee137708ec8 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
|
@@ -57,6 +57,7 @@ Contributors | |
~~~~~~~~~~~~ | ||
|
||
* Juan Miguel Sánchez Arce <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
1 change: 1 addition & 0 deletions
1
shopfloor_single_product_transfer_force_package/readme/CONTRIBUTORS.rst
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 @@ | ||
* Juan Miguel Sánchez Arce <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> |
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 2023 Camptocamp SA | ||
# Copyright 2023 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
|
||
|
@@ -8,12 +9,20 @@ | |
class ShopfloorSingleProductTransfer(Component): | ||
_inherit = "shopfloor.single.product.transfer" | ||
|
||
def _set_quantity__check_location(self, move_line, location, confirmation=False): | ||
def _set_quantity__check_location( | ||
self, move_line, location, package=None, confirmation=False | ||
): | ||
# We add an additional check to verify if the location requires packages | ||
# and return a message to the user accordingly. | ||
if location.package_restriction and not move_line.result_package_id: | ||
if ( | ||
location.package_restriction | ||
and not package | ||
and not move_line.result_package_id | ||
): | ||
message = self.msg_store.location_requires_package() | ||
return self._response_for_set_quantity( | ||
move_line, message=message, asking_confirmation=None | ||
) | ||
return super()._set_quantity__check_location(move_line, location, confirmation) | ||
return super()._set_quantity__check_location( | ||
move_line, location, package=package, confirmation=confirmation | ||
) |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ Shopfloor Single Product Transfer Unique Order Per Location | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:293d3465d5bee7cc00f12378573974df153d01784247d13d8f80373cdcb7121d | ||
!! source digest: sha256:6009aa6960e9ba8bda6b2942b50f38fb7dd25cf7c0e1c9820f643c838e0ec0e9 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
|
@@ -60,6 +60,7 @@ Contributors | |
~~~~~~~~~~~~ | ||
|
||
* Thierry Ducrest <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
1 change: 1 addition & 0 deletions
1
shopfloor_single_product_transfer_unique_order_at_location/readme/CONTRIBUTORS.rst
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 @@ | ||
* Thierry Ducrest <[email protected]> | ||
* Michael Tietz (MT Software) <[email protected]> |
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 2023 Camptocamp SA | ||
# Copyright 2023 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo.exceptions import UserError | ||
|
@@ -10,9 +11,11 @@ class ShopfloorSingleProductTransfer(Component): | |
_inherit = "shopfloor.single.product.transfer" | ||
|
||
def _set_quantity__check_location( | ||
self, move_line, location=False, confirmation=False | ||
self, move_line, location=False, package=False, confirmation=False | ||
): | ||
res = super()._set_quantity__check_location(move_line, location, confirmation) | ||
res = super()._set_quantity__check_location( | ||
move_line, location, package=package, confirmation=confirmation | ||
) | ||
# Could also be asking for confirmation with a warning | ||
if res and res.get("message", {}).get("message_type", "") == "error": | ||
return res | ||
|
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