Skip to content

Commit

Permalink
Add shopfloor_checkout_putinpack_restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
TDu committed Dec 4, 2023
1 parent 11484a1 commit 410fde7
Show file tree
Hide file tree
Showing 14 changed files with 694 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/shopfloor_checkout_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,
)
97 changes: 97 additions & 0 deletions shopfloor_checkout_putinpack_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
==========================================
Shopfloor Checkout Put In Pack Restriction
==========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c41308e3379843fe0566e62fdc74629ab919e92f8206447846a761d238cbbc5b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-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/14.0/shopfloor_checkout_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-14-0/wms-14-0-shopfloor_checkout_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=14.0
:alt: Try me on Runboat

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

This module extends the checkout scenario of the shopfloor module.
And depends on `stock_picking_putinpack_restriction` from
`stock-logistic-workflow`.

It restricts the display of the put in pack buttons from the
`select_package` state.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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_checkout_putinpack_restriction%0Aversion:%2014.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
~~~~~~~

* Camptocamp
* BCIM
* Raumschmiede

Contributors
~~~~~~~~~~~~

* Thierry Ducrest <[email protected]>
* Joshua Lauer <[email protected]>

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.

.. |maintainer-TDu| image:: https://github.com/TDu.png?size=40px
:target: https://github.com/TDu
:alt: TDu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-TDu|

This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/14.0/shopfloor_checkout_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_checkout_putinpack_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import actions
from . import services
21 changes: 21 additions & 0 deletions shopfloor_checkout_putinpack_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

{
"name": "Shopfloor Checkout Put In Pack Restriction",
"summary": "",
"version": "14.0.1.0.0",
"development_status": "Alpha",
"category": "Inventory",
"website": "https://github.com/OCA/wms",
"author": "Camptocamp, BCIM, Raumschmiede, Odoo Community Association (OCA)",
"maintainers": ["TDu"],
"license": "AGPL-3",
"depends": [
# OCA/wms
"shopfloor",
# OCA/stock-logistics-workflow
"stock_picking_putinpack_restriction",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import message
15 changes: 15 additions & 0 deletions shopfloor_checkout_putinpack_restriction/actions/message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import _

from odoo.addons.component.core import Component


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

def package_not_allowed_for_operation(self):
return {
"message_type": "error",
"body": _("The operation does not allow the use of package"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Thierry Ducrest <[email protected]>
* Joshua Lauer <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module extends the checkout scenario of the shopfloor module.
And depends on `stock_picking_putinpack_restriction` from
`stock-logistic-workflow`.

It restricts the display of the put in pack buttons from the
`select_package` state.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import checkout
23 changes: 23 additions & 0 deletions shopfloor_checkout_putinpack_restriction/services/checkout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)


from odoo.addons.component.core import Component


class Checkout(Component):
_inherit = "shopfloor.checkout"

def _data_response_for_select_package(self, picking, lines, message=None):
res = super()._data_response_for_select_package(picking, lines)
if picking.put_in_pack_restriction == "no_package":
res["package_allowed"] = False
elif picking.put_in_pack_restriction == "with_package":
res["no_package_enabled"] = False
return res

def _check_scan_package_find(self, picking, search_result):
if search_result.type in ["package", "delivery_packaging"]:
if picking.put_in_pack_restriction == "no_package":
return self.msg_store.package_not_allowed_for_operation()
return super()._check_scan_package_find(picking, search_result)
Loading

0 comments on commit 410fde7

Please sign in to comment.