Skip to content

Commit

Permalink
[ADD] stock_picking_by_package: Select Packages to add their content …
Browse files Browse the repository at this point in the history
…to a stock transfer
  • Loading branch information
dreispt committed Dec 22, 2023
1 parent f829eb6 commit 25f57c0
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 0 deletions.
94 changes: 94 additions & 0 deletions stock_picking_by_package/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
========================
Stock Transfers Lot Info
========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_info_lot
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_info_lot
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/154/16.0
:alt: Try me on Runbot

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

This feature adds a text field that allows for inventory operations (i.e. picking out) to have additional information about the lot numbers being moved.
This can be relevant, for example, when the warehouse management is outsourced to a third party provider, that is in charge of managing the actual lot tracking.
It allows for Odoo store the lot information relayed by the 3PL, for information or reporting purposes.
Note that this is different from the case where Odoo is doing the actual lot/serial number tracking, and this feature is expected to be used with Odoo lot tracking disabled.

**Table of contents**

.. contents::
:local:

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

Products have a "Lot Information" definition, under the "Inventory" tab.
It can be set to one of "No" (default), "Optional", "Required".

Usage
=====

When doing a Stock Transfer, an additional "Lot Info" column is available in the "Detailed Operations" tab/window.
It is editable for products that don't have the "Lot Info" definition set to "No", and it is required for the products that have the "Lot Info" definition set to "Required".

Known issues / Roadmap
======================

Add an option to activate lot info field on picking type level.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_info_lot%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
~~~~~~~

* S.P.O.C.

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

* Artem Zavarin <zavarin@spoc.com.ua> (https://spoc.com.ua/)
* Daniel Reis <dreis@opensourceintegrators.com> (https://opensourceintegrators.com)

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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_info_lot>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_picking_by_package/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions stock_picking_by_package/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 Open Source Integrators
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Deliver or Transfer Packages",
"summary": "Select Packages to add their content to a stock transfer",
"website": "https://github.com/OCA/stock-logistics-workflow",
"license": "AGPL-3",
"author": "Luz de Airbag, Open Source Integrators, Odoo Community Association (OCA)",
"category": "Warehouse",
"version": "16.0.1.0.0",
"depends": ["stock"],
}
1 change: 1 addition & 0 deletions stock_picking_by_package/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move
35 changes: 35 additions & 0 deletions stock_picking_by_package/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# opyright 2023 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models


class StockMove(models.Model):
_inherit = "stock.move"

def _action_assign(self, force_qty=False):
pick_packages = self.picking_id.package_level_ids.filtered(
lambda x: x.state in ["draft"]
)
# Set the Package Level on the Move Line
# This will force the reservation from that Package
# Then reset the Package Level on Move Line, to that it stays visible
if pick_packages:
for pick_package in pick_packages:
self.write({"package_level_id": pick_package.id})
super()._action_assign(force_qty=force_qty)
self._set_quantities_to_reservation()
self.write({"package_level_id": None})
# Items not found in Packages go through regular reservation
to_assign = self.filtered(lambda x: not x.reserved_availability)
res = super(StockMove, to_assign)._action_assign(force_qty=force_qty)
return res

def _do_unreserve(self):
res = super()._do_unreserve()
# Unreserve migh leave dangling Move Lines, because Quantity Done is set
# Delete move lines with no reserved quantity and a Source Package set
to_delete = self.move_line_ids.filtered(
lambda x: x.package_id and not x.reserved_uom_qty
)
to_delete.unlink()
return res
8 changes: 8 additions & 0 deletions stock_picking_by_package/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enable the Packages option, on Inventory / Configuration / Settings.

On Delivery operation type, recommended configuration is:

* Move entire Packages: checked (required)
* Reservation Method: Manually
(recommended, in case you want to manually pick the Lot/Serial#)
* Show Detailed Operations: unchecked (recommended)
1 change: 1 addition & 0 deletions stock_picking_by_package/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Daniel Reis <dreis@opensourceintegrators.com> (https://opensourceintegrators.com)
5 changes: 5 additions & 0 deletions stock_picking_by_package/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Odoo Packages allow a Picking to record that some items were packaged together.
They are not transfereable storage item themselves.

If, for example, on reveiving, items were put together in a package,
you might need on a later Delivery or Transfer to pick that package.
9 changes: 9 additions & 0 deletions stock_picking_by_package/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
On a Stock Transfer, Operations tab:

* On the packages list, add the Packages to pick
* Click on "Check Availability".
You might need to click before on "Unreserve",
in case an automatic reservation was done.

The selected Package quants will then be used and assigned
by the "Check Availability" reservation process.

0 comments on commit 25f57c0

Please sign in to comment.