Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WMS][13.0] Add stock_dynamic_routing - alpha version #788

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
56e5079
Add stock_routing_operation
guewen Jul 2, 2019
d6e20a8
Allow to bypass the routing operation for a move
florian-dacosta Dec 13, 2019
b32f586
Add comment
guewen Mar 11, 2020
1751792
Change rules for source routing
guewen Apr 3, 2020
227a148
Add domain to exclude moves from source routing
guewen Apr 3, 2020
6bd18f4
Use as savepoint to cancel _action_assign
guewen Apr 6, 2020
e3d48cb
Delete package level of move lines when unreserving
guewen Apr 6, 2020
66e267c
Rework using dedicated models
guewen Apr 7, 2020
fd0b20e
pre-commit: run new xml prettier
guewen Apr 7, 2020
298460e
Fix support of partial reservation on pull routing rules
guewen Apr 8, 2020
7e9c318
Refactor pull to avoid assign+unreserve between split and routing
guewen Apr 8, 2020
db5518a
Rework push routing rules, with reclassification
guewen Apr 8, 2020
46472ed
Add tests
guewen Apr 9, 2020
de2417f
Refactor: include push rules in the same "workflow" used for pull rules
guewen Apr 9, 2020
afec4a2
Apply routing in chain
guewen Apr 23, 2020
4cedf22
Fix product_qty handling
guewen Apr 23, 2020
462e3cf
Fix assigned called twice on the same move
guewen Apr 23, 2020
6740b48
Remove dead code
guewen Apr 24, 2020
f43ea35
Extract methods in the push method
guewen Apr 24, 2020
80211a3
Optimize calls to _action_assign()
guewen Apr 29, 2020
355b87a
Keep final destination on push routing rules
guewen Apr 29, 2020
cdc6b54
Rename stock_routing_operation to stock_dynamic_routing
guewen Apr 30, 2020
7920788
Add comment for a needed fix
guewen May 1, 2020
3183abe
Replace ormcache by a local lru_cache
guewen May 4, 2020
1d70664
Reduce number of SQL queries on stock_location
guewen May 15, 2020
9a31d14
Add tests for finding rules
guewen May 18, 2020
dd30d35
Add mandatory picking type on dynamic routing
guewen May 25, 2020
0e96ea6
Allow to select sub-location's picking types in rules
guewen May 25, 2020
5e4714c
Improve usability, show routing description
guewen May 25, 2020
54081be
Improve readability for location comparisons
guewen May 27, 2020
53c0b8b
Fix bug on move copy, reset package level
guewen Jun 3, 2020
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/stock_routing_operation/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_routing_operation/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_routing_operation/__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_routing_operation/__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 Routing Operations",
"summary": "Add extra routing operations for special locations",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"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": "Alpha",
}
23 changes: 23 additions & 0 deletions stock_routing_operation/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_routing_operation/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>
28 changes: 28 additions & 0 deletions stock_routing_operation/demo/stock_routing_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="stock_routing_highbay_demo" model="stock.routing">
<field name="location_id" ref="stock_location_highbay_demo" />
</record>
<record
id="stock_routing_rule_highbay_pull_handover_demo"
model="stock.routing.rule"
>
<field name="routing_id" ref="stock_routing_highbay_demo" />
<field name="method">pull</field>
<field
name="picking_type_id"
ref="stock_picking_type_highbay_to_handover_demo"
/>
</record>
<record
id="stock_routing_rule_highbay_push_handover_demo"
model="stock.routing.rule"
>
<field name="routing_id" ref="stock_routing_highbay_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_routing_operation/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
33 changes: 33 additions & 0 deletions stock_routing_operation/models/stock_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models, tools


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

@tools.ormcache("self.id")
def _location_parent_tree(self):
self.ensure_one()
tree = self.search(
[("id", "parent_of", self.id)],
# the recordset will be ordered bottom location to top location
order="parent_path desc",
)
return tree

@api.model_create_multi
def create(self, vals_list):
locations = super().create(vals_list)
self._location_parent_tree.clear_cache(self)
return locations

def write(self, values):
res = super().write(values)
self._location_parent_tree.clear_cache(self)
return res

def unlink(self):
res = super().unlink()
self._location_parent_tree.clear_cache(self)
return res
Loading