Skip to content

Commit

Permalink
Merge PR #31 into 13.0
Browse files Browse the repository at this point in the history
Signed-off-by jgrandguillaume
  • Loading branch information
OCA-git-bot committed Jun 24, 2020
2 parents 576ec81 + f5d93ca commit 5c3e1be
Show file tree
Hide file tree
Showing 25 changed files with 3,805 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_dynamic_routing/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,
)
182 changes: 182 additions & 0 deletions stock_dynamic_routing/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
========================
Stock Routing Operations
========================

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

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

Route explains the steps you want to produce whereas the “picking routing
operation” defines how operations are grouped according to their final source
and destination location.

This allows for example:

* To parallelize picking operations in two locations of a warehouse, splitting
them in two different picking type
* To define pre-picking (wave) in some sub-locations, then roundtrip picking of
the sub-location waves

Context for the use cases:

In the warehouse, you have a High-Bay which requires to place goods in a
handover when you move goods in or out of it. The High-Bay contains many
sub-locations.

A product can be stored either in the High-Bay, either in the Shelving zone.

When picking:

When there is enough stock in the Shelving, you expect the moves to have the
usual Pick(Highbay)-Pack-Ship steps. If the good is picked from the High-Bay, you will
need an extra operation: Pick(Highbay)-Handover-Pack-Ship.

This is what this feature is doing: on the High-Bay location, you define
a "routing operation". A routing operation is based on a picking type.
The extra operation will have the selected picking type, and the new move
will have the source destination of the picking type.

When putting away:

A put-away rule targets the High-Bay location.
An operation Input-Highbay is created. You expect Input-Handover-Highbay.

You can configure a routing operation for the put-away on the High-Bay Location.
The picking type of the new Handover move will the routing operation selected,
and its destination will be the destination of the picking type.

.. 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:

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

In Inventory Settings, you must have:

* Storage Locations
* Multi-Warehouses
* Multi-Step Routes

On stock location, create an "Routing operation" operation type.
The default destination location will be the destination location
of the new operation inserted when a move has a source location which
is a child of the location.

Usage
=====

Try on runbot
~~~~~~~~~~~~~

* In Inventory Settings, activate:

* Storage Locations
* Multi-Warehouses
* Multi-Step Routes

The initial setup in the demo data contains locations:

* WH/Stock/Highbay
* WH/Stock/Highbay/Bin 1
* WH/Stock/Highbay/Bin 2
* WH/Stock/Handover

The "Highbay" location (and children) is configured to:

* create a source routing operation from Highbay to Handover when
goods are taken from Highbay (using a new picking type Highbay → Handover)
* create a destination routing operation from Handover to Highbay when
goods are put to Highbay (using a new picking type Handover → Highbay)

Steps to try the Source Routing Operation:

* In the main Warehouse, configure outgoing shipments to "Send goods in output and then deliver (2 steps)"
* Inventory a product, for instance "[FURN_8999] Three-Seat Sofa", add 50 items in "WH/Stock/Highbay/Bay A/Bin 1", and nowhere else
* Create a sales order with 5 "[FURN_8999] Three-Seat Sofa", confirm
* You'll have 3 transfers; a new one has been created dynamically for Highbay -> Handover.

Steps to try the Destination Routing Operation:

* In the "WH/Stock" location, create a Put-Away Strategy with:

* "[DESK0004] Customizable Desk (Aluminium, Black)" to location "WH/Stock/Highbay/Bay A/Bin 1"
* "[E-COM06] Corner Desk Right Sit" to location "WH/Stock/Shelf 1"

* Create a new purchase order of:

* 5 "[DESK0004] Customizable Desk (Aluminium, Black)"
* 5 "[E-COM06] Corner Desk Right Sit"

* Confirm the purchase
* You'll have 2 transfers:

* one to move DESK0004 from Supplier → Handover and E-COM06 from Supplier → Shelf 1
* one waiting on the other to move DESK0004 from Handover → WH/Stock/Highbay/Bay A/Bin 1 (the final location of the put-away)

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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-warehouse/issues/new?body=module:%20stock_routing_operation%0Aversion:%2013.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

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

* Joël Grand-Guillaume <[email protected]>
* Guewen Baconnier <[email protected]>
* Akim Juillerat <[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.

This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_routing_operation>`_ 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_dynamic_routing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions stock_dynamic_routing/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019 Camptocamp (https://www.camptocamp.com)
{
"name": "Stock Dynamic Routing",
"summary": "Dynamic routing of stock moves",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"category": "Warehouse Management",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"depends": ["stock"],
"demo": [
"demo/stock_location_demo.xml",
"demo/stock_picking_type_demo.xml",
"demo/stock_routing_demo.xml",
],
"data": ["views/stock_routing_views.xml", "security/ir.model.access.csv"],
"installable": True,
"development_status": "Beta",
}
23 changes: 23 additions & 0 deletions stock_dynamic_routing/demo/stock_location_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="stock_location_highbay_demo" model="stock.location">
<field name="name">Highbay</field>
<field name="location_id" ref="stock.stock_location_stock" />
</record>
<record id="stock_location_highbay_a_demo" model="stock.location">
<field name="name">Bay A</field>
<field name="location_id" ref="stock_location_highbay_demo" />
</record>
<record id="stock_location_highbay_a_1_demo" model="stock.location">
<field name="name">Bin 1</field>
<field name="location_id" ref="stock_location_highbay_a_demo" />
</record>
<record id="stock_location_highbay_demo_1_2" model="stock.location">
<field name="name">Bin 2</field>
<field name="location_id" ref="stock_location_highbay_a_demo" />
</record>
<record id="stock_location_handover_demo" model="stock.location">
<field name="name">Handover</field>
<field name="location_id" ref="stock.stock_location_stock" />
</record>
</odoo>
23 changes: 23 additions & 0 deletions stock_dynamic_routing/demo/stock_picking_type_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record model="stock.picking.type" id="stock_picking_type_highbay_to_handover_demo">
<field name="name">Highbay → Handover</field>
<field name="code">internal</field>
<field name="sequence_code">HBHO</field>
<field name="use_create_lots" eval="False" />
<field name="use_existing_lots" eval="True" />
<field name="warehouse_id" ref="stock.warehouse0" />
<field name="default_location_src_id" ref="stock_location_highbay_demo" />
<field name="default_location_dest_id" ref="stock_location_handover_demo" />
</record>
<record model="stock.picking.type" id="stock_picking_type_handover_to_highbay_demo">
<field name="name">Handover → Highbay</field>
<field name="code">internal</field>
<field name="sequence_code">HOHB</field>
<field name="use_create_lots" eval="False" />
<field name="use_existing_lots" eval="True" />
<field name="warehouse_id" ref="stock.warehouse0" />
<field name="default_location_src_id" ref="stock_location_handover_demo" />
<field name="default_location_dest_id" ref="stock_location_highbay_demo" />
</record>
</odoo>
37 changes: 37 additions & 0 deletions stock_dynamic_routing/demo/stock_routing_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="stock_routing_highbay_pick_demo" model="stock.routing">
<field name="location_id" ref="stock_location_highbay_demo" />
<field
name="picking_type_id"
model="stock.warehouse"
eval="obj().env.ref('stock.warehouse0').pick_type_id.id"
/>
</record>
<record
id="stock_routing_rule_highbay_pull_handover_demo"
model="stock.routing.rule"
>
<field name="routing_id" ref="stock_routing_highbay_pick_demo" />
<field name="method">pull</field>
<field
name="picking_type_id"
ref="stock_picking_type_highbay_to_handover_demo"
/>
</record>
<record id="stock_routing_highbay_receipt_demo" model="stock.routing">
<field name="location_id" ref="stock_location_highbay_demo" />
<field name="picking_type_id" ref="stock.picking_type_in" />
</record>
<record
id="stock_routing_rule_highbay_push_handover_demo"
model="stock.routing.rule"
>
<field name="routing_id" ref="stock_routing_highbay_receipt_demo" />
<field name="method">push</field>
<field
name="picking_type_id"
ref="stock_picking_type_handover_to_highbay_demo"
/>
</record>
</odoo>
5 changes: 5 additions & 0 deletions stock_dynamic_routing/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import stock_location
from . import stock_move
from . import stock_picking
from . import stock_routing
from . import stock_routing_rule
26 changes: 26 additions & 0 deletions stock_dynamic_routing/models/stock_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import models


class StockLocation(models.Model):
_inherit = "stock.location"

def _location_parent_tree(self):
self.ensure_one()
# Build the tree of parent locations, we don't need SQL
# at all since the parent ids are all in the parent path.
tree_ids = [int(tree_id) for tree_id in self.parent_path.rstrip("/").split("/")]
# the recordset will be ordered bottom location to top location
tree_ids.reverse()
return self.browse(tree_ids)

def is_sublocation_of(self, others):
"""Return True if self is a sublocation of at least one other
It is equivalent to the "child_of" operator, so it includes itself.
"""
self.ensure_one()
# Efficient way to verify that the current location is
# below one of the other location without using SQL.
return any(self.parent_path.startswith(other.parent_path) for other in others)
Loading

0 comments on commit 5c3e1be

Please sign in to comment.