Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/shopfloor_reception_putinpack_restriction/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
28 changes: 18 additions & 10 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,20 @@ def _set_quantity__by_package(self, picking, selected_line, package):
return self._response_for_select_move(picking)
return self._response_for_set_destination(picking, selected_line)

def _set_quantity__by_new_package(
self, picking, selected_line, barcode: str, confirmation: str
):
if confirmation != barcode:
return self._response_for_set_quantity(
picking,
selected_line,
message=self.msg_store.create_new_pack_ask_confirmation(barcode),
asking_confirmation=barcode,
)
package = self.env["stock.quant.package"].create({"name": barcode})
selected_line.result_package_id = package
return self._response_for_set_destination(picking, selected_line)

def _set_quantity__by_location(self, picking, selected_line, location):
move_dest_location_ok, pick_type_dest_location_ok = self._check_location_ok(
location, selected_line, picking
Expand Down Expand Up @@ -1322,18 +1336,12 @@ def _set_quantity__by_barcode(
handler = handlers_by_type.get(search_result.type)
if handler:
return handler(picking, selected_line, search_result.record)

# Nothing found, ask user if we should create a new pack for the scanned
# barcode
if confirmation != barcode:
return self._response_for_set_quantity(
picking,
selected_line,
message=self.msg_store.create_new_pack_ask_confirmation(barcode),
asking_confirmation=barcode,
)
package = self.env["stock.quant.package"].create({"name": barcode})
selected_line.result_package_id = package
return self._response_for_set_destination(picking, selected_line)
return self._set_quantity__by_new_package(
picking, selected_line, barcode, confirmation
)

def _set_quantity__assign_quantity(self, picking, selected_line, quantity):
# If this is a return line, we cannot assign more qty_done than what
Expand Down
16 changes: 13 additions & 3 deletions shopfloor_reception_mobile/static/src/scenario/reception.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,17 @@ const Reception = {
/>
</v-card>
<div class="button-list button-vertical-list full">
<v-row align="center">
<v-row v-if="show_with_pack_actions" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_add_to_existing_pack">Existing pack</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-row v-if="show_with_pack_actions" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_create_new_pack">New pack</btn-action>
</v-col>
</v-row>
<v-row align="center">
<v-row v-if="show_without_pack_actions" align="center">
<v-col class="text-center" cols="12">
<btn-action @click="state.on_process_without_pack">Process without pack</btn-action>
</v-col>
Expand Down Expand Up @@ -212,6 +212,16 @@ const Reception = {
</Screen>
`,
computed: {
show_with_pack_actions: function () {
const put_in_pack_restriction = this.state.data.put_in_pack_restriction;
if (!put_in_pack_restriction) return true;
return put_in_pack_restriction === "with_package";
},
show_without_pack_actions: function () {
const put_in_pack_restriction = this.state.data.put_in_pack_restriction;
if (!put_in_pack_restriction) return true;
return put_in_pack_restriction === "no_package";
},
visible_pickings: function () {
return !_.isEmpty(this.filtered_pickings)
? this.filtered_pickings
Expand Down
105 changes: 105 additions & 0 deletions shopfloor_reception_putinpack_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================================
Shopfloor Reception Putinpack Restriction
=========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:71a2246186c7fd5828b67a511f45c844b51bd1124ca43605ea0531e073a117db
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github
:target: https://github.com/OCA/wms/tree/16.0/shopfloor_reception_putinpack_restriction
:alt: OCA/wms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-shopfloor_reception_putinpack_restriction
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/wms&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows administrators to simplify the shopfloor user
interface by hiding package-related actions during the reception
scenario.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

It is specifically designed for warehouses that want to control if goods
are put in a pack or cannot be put in a pack, here at the end of the
reception. This prevents warehouse operators from freely choosing by
hiding forbidden buttons.

Configuration
=============

You can configure on the picking type if you want to use packages or
not.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/wms/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/wms/issues/new?body=module:%20shopfloor_reception_putinpack_restriction%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* ACSONE SA/NV
* BCIM

Contributors
------------

- Nicolas Delbovier nicolas.delbovier@acsone.eu (https://www.acsone.eu/)
- Jacques-Etienne Baudoux (BCIM) je@bcim.be

Other credits
-------------

The development of this module has been financially supported by:

- Alcyon Belux

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/shopfloor_reception_putinpack_restriction>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions shopfloor_reception_putinpack_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import services
from . import actions
17 changes: 17 additions & 0 deletions shopfloor_reception_putinpack_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Shopfloor Reception Putinpack Restriction",
"summary": """Restrict the use of packages in shopfloor reception""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"depends": [
"shopfloor_reception",
"stock_picking_putinpack_restriction",
],
"data": [],
"demo": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import message
31 changes: 31 additions & 0 deletions shopfloor_reception_putinpack_restriction/actions/message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2026 ACSONE SA/NV (https://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging

from odoo import _

from odoo.addons.component.core import Component

_logger = logging.getLogger(__name__)


class MessageAction(Component):
_inherit = "shopfloor.message.action"

def package_not_allowed_for_operation(self, picking):
return {
"message_type": "error",
"body": _(
"The operation '%(picking_type)s' does not allow the use of package.",
picking_type=picking.picking_type_id.display_name,
),
}

def package_required_for_operation(self, picking):
return {
"message_type": "error",
"body": _(
"The operation '%(picking_type)s' requires a package.",
picking_type=picking.picking_type_id.display_name,
),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You can configure on the picking type if you want to use packages or not.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
It is specifically designed for warehouses that want to control if goods are put in a pack or cannot be put in a pack, here at the end of the reception. This prevents warehouse operators from freely choosing by hiding forbidden buttons.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Nicolas Delbovier <nicolas.delbovier@acsone.eu> (https://www.acsone.eu/)
- Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
3 changes: 3 additions & 0 deletions shopfloor_reception_putinpack_restriction/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

- Alcyon Belux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows administrators to simplify the shopfloor user interface by hiding package-related actions during the reception scenario.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import reception
125 changes: 125 additions & 0 deletions shopfloor_reception_putinpack_restriction/services/reception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from datetime import timezone

from odoo.addons.component.core import Component

UTC = timezone.utc


class Reception(Component):
_inherit = "shopfloor.reception"

def _check_picking_putinpack_restriction(self, picking, with_pack: bool):
if picking.put_in_pack_restriction == "no_package" and with_pack:
return self.msg_store.package_not_allowed_for_operation(picking)
if picking.put_in_pack_restriction == "with_package" and not with_pack:
return self.msg_store.package_required_for_operation(picking)

def process_with_existing_pack(self, picking_id, selected_line_id, quantity):
picking = self.env["stock.picking"].browse(picking_id)
selected_line = self.env["stock.move.line"].browse(selected_line_id)

if message := self._check_picking_putinpack_restriction(
picking, with_pack=True
):
return self._response_for_set_quantity(
picking, selected_line, message=message
)
res = super().process_with_existing_pack(picking_id, selected_line_id, quantity)

return res

def process_with_new_pack(self, picking_id, selected_line_id, quantity):
picking = self.env["stock.picking"].browse(picking_id)
selected_line = self.env["stock.move.line"].browse(selected_line_id)

if message := self._check_picking_putinpack_restriction(
picking, with_pack=True
):
return self._response_for_set_quantity(
picking, selected_line, message=message
)
res = super().process_with_new_pack(picking_id, selected_line_id, quantity)

return res

def process_without_pack(self, picking_id, selected_line_id, quantity):
picking = self.env["stock.picking"].browse(picking_id)
selected_line = self.env["stock.move.line"].browse(selected_line_id)

if message := self._check_picking_putinpack_restriction(
picking, with_pack=False
):
return self._response_for_set_quantity(
picking, selected_line, message=message
)
res = super().process_without_pack(picking_id, selected_line_id, quantity)

return res

def _set_quantity__by_package(self, picking, selected_line, package):
if message := self._check_picking_putinpack_restriction(
picking, with_pack=True
):
return self._response_for_set_quantity(
picking, selected_line, message=message
)
Comment thread
nicolas-delbovier-acsone marked this conversation as resolved.
return super()._set_quantity__by_package(picking, selected_line, package)

def _set_quantity__by_new_package(
self, picking, selected_line, barcode: str, confirmation: str
):
if message := self._check_picking_putinpack_restriction(
picking, with_pack=True
):
return self._response_for_set_quantity(
picking, selected_line, message=message
)
return super()._set_quantity__by_new_package(
picking, selected_line, barcode, confirmation
)

def _response_for_set_quantity(
self, picking, line, message=None, asking_confirmation=None
):
pip_restriction = picking.put_in_pack_restriction

if pip_restriction == "no_package" and asking_confirmation:
return self._response_for_set_quantity(
picking,
line,
message=self.msg_store.package_not_allowed_for_operation(picking),
)

res = super()._response_for_set_quantity(
picking, line, message, asking_confirmation
)
if pip_restriction:
res["data"]["set_quantity"]["put_in_pack_restriction"] = pip_restriction
return res


class ShopfloorReceptionValidatorResponse(Component):
_inherit = "shopfloor.reception.validator.response"

@property
def _schema_set_quantity(self):
res = super()._schema_set_quantity
picking_type_model = self.env["stock.picking.type"]
selection_put_in_pack_restriction_values = [
x[0] for x in picking_type_model._selection_put_in_pack_restriction()
]
res.update(
{
"put_in_pack_restriction": {
"type": "string",
"nullable": True,
"required": False,
"allowed": selection_put_in_pack_restriction_values,
},
}
)
return res
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading