Skip to content
Open
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_full_location_reservation/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,
)
86 changes: 86 additions & 0 deletions shopfloor_full_location_reservation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
===================================
Shopfloor full location reservation
===================================

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

.. |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/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/16.0/shopfloor_full_location_reservation
: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_full_location_reservation
: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|

Adds a configuration to the shopfloor scenario which allows to trigger the stock full location reservation

**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_full_location_reservation%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
~~~~~~~

* MT Software

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

* Michael Tietz (MT Software) <mtietz@mt-software.de>
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
* Denis Roussel <denis.roussel@acsone.eu>

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-mt-software-de| image:: https://github.com/mt-software-de.png?size=40px
:target: https://github.com/mt-software-de
:alt: mt-software-de

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

|maintainer-mt-software-de|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions shopfloor_full_location_reservation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from . import services
from .hooks import post_init_hook
24 changes: 24 additions & 0 deletions shopfloor_full_location_reservation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Shopfloor full location reservation",
"summary": (
"Adds a configuration to the shopfloor scenario "
"which allows to trigger the stock full location reservation"
),
"author": "MT Software, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"category": "Warehouse Management",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": [
"shopfloor",
"stock_full_location_reservation",
],
"data": [
"views/shopfloor_menu.xml",
],
"auto_install": True,
"post_init_hook": "post_init_hook",
"maintainers": ["mt-software-de"],
}
17 changes: 17 additions & 0 deletions shopfloor_full_location_reservation/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json

from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})

for scenario in [
env.ref("shopfloor.scenario_location_content_transfer"),
env.ref("shopfloor.scenario_zone_picking"),
]:
options = scenario.options
options["full_location_reservation"] = True
scenario.options_edit = json.dumps(options)
1 change: 1 addition & 0 deletions shopfloor_full_location_reservation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import shopfloor_menu
27 changes: 27 additions & 0 deletions shopfloor_full_location_reservation/models/shopfloor_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class ShopfloorMenu(models.Model):
_inherit = "shopfloor.menu"

full_location_reservation_is_possible = fields.Boolean(
compute="_compute_full_location_reservation_is_possible"
)
full_location_reservation = fields.Boolean(
string="Process full location reservation",
default=False,
help=(
"If you tick this box, a full location reservation "
"is triggered for each move_lines location which was found."
),
)

@api.depends("scenario_id")
def _compute_full_location_reservation_is_possible(self):
for menu in self:
menu.full_location_reservation_is_possible = menu.scenario_id.has_option(
"full_location_reservation"
)
3 changes: 3 additions & 0 deletions shopfloor_full_location_reservation/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Michael Tietz (MT Software) <mtietz@mt-software.de>
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
* Denis Roussel <denis.roussel@acsone.eu>
1 change: 1 addition & 0 deletions shopfloor_full_location_reservation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds a configuration to the shopfloor scenario which allows to trigger the stock full location reservation
2 changes: 2 additions & 0 deletions shopfloor_full_location_reservation/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import location_content_transfer
from . import zone_picking
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component


class LocationContentTransfer(Component):
_inherit = "shopfloor.location.content.transfer"

def _find_location_move_lines_from_scan_location(self, *args, **kwargs):
move_lines = super()._find_location_move_lines_from_scan_location(
*args, **kwargs
)
if not self.work.menu.full_location_reservation:
return move_lines

if any(move_lines.move_id.mapped("is_full_location_reservation")):
return move_lines

move_lines |= move_lines._full_location_reservation().move_line_ids
return move_lines.exists()

def _move_lines_cancel_work(self, move_lines):
res = super()._move_lines_cancel_work(move_lines)
if not self.work.menu.full_location_reservation:
return res
move_lines.move_id.undo_full_location_reservation()
return res
41 changes: 41 additions & 0 deletions shopfloor_full_location_reservation/services/zone_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.addons.component.core import Component


class ZonePicking(Component):
_inherit = "shopfloor.zone.picking"

def _handle_full_location_package_reservation(self, package):
return package and self.work.menu.full_location_reservation

def _handle_complete_mix_pack(self, package):
"""Return true if full location reservation is enabled
otherwise if there is not more than one product on the package
it will return False
"""
if self._handle_full_location_package_reservation(package):
return True
return super()._handle_complete_mix_pack(package)

def _set_destination_location(
self, move_line, package, quantity, confirmation, location, barcode
):
if self._handle_full_location_package_reservation(package):
move_line._full_location_reservation(package_only=True)
# Ensure all move lines have the same destination package.
# If moves lines are in different pickings, the destination package
# is not set in standard
# a stock.package_level is only created if all products of the package
# are contained in the picking
move_line.search(
[
("package_id", "=", package.id),
("state", "in", ("partially_available", "assigned")),
("result_package_id", "!=", package.id),
]
).result_package_id = package
return super()._set_destination_location(
move_line, package, quantity, confirmation, location, barcode
)
Loading