Skip to content

Commit

Permalink
[IMP] stock_storage_type: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandregaldeano committed Jan 17, 2025
1 parent b602d3c commit e5c91e8
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 267 deletions.
Binary file added pandoc-3.6.2-x86_64-macOS.pkg
Binary file not shown.
170 changes: 89 additions & 81 deletions stock_storage_type/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,70 @@ Stock Storage Type
: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/stock_storage_type
:target: https://github.com/OCA/wms/tree/17.0/stock_storage_type
: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-stock_storage_type
:target: https://translation.odoo-community.org/projects/wms-17-0/wms-17-0-stock_storage_type
: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
:target: https://runboat.odoo-community.org/builds?repo=OCA/wms&target_branch=17.0
:alt: Try me on Runboat

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

This module introduces two new models in order to manage stock moves with
packages according to the packaging and stock location properties.
| This module introduces two new models in order to manage stock moves
with
| packages according to the packaging and stock location properties.
* Stock package storage type (`stock.package.storage.type`)
- Stock package storage type (stock.package.storage.type)

This model is linked to product.packaging and defines the type of storage
related to a specific packaging.
This model is linked to product.packaging and defines the type of
storage related to a specific packaging.

* Stock location storage type (`stock.location.storage.type`)
- Stock location storage type (stock.location.storage.type)

This models is linked to stock.location and defines the types of storage
that are allowed for a specific location.
This models is linked to stock.location and defines the types of
storage that are allowed for a specific location.

Therefore a Stock location storage type can include different Stock package
storage type in order to validate the destination of a move with package into a
stock location.
Moreover Stock location storage type can include product, size or lot
restrictions for the stock locations it's defined on, so that a move with
package will only be allowed if it doesn't violate the restrictions defined
(cf stock_location_storage_type_strategy).
Therefore a Stock location storage type can include different Stock
package storage type in order to validate the destination of a move with
package into a stock location. Moreover Stock location storage type can
include product, size or lot restrictions for the stock locations it's
defined on, so that a move with package will only be allowed if it
doesn't violate the restrictions defined (cf
stock_location_storage_type_strategy).

Moreover, this module implements "storage type put-away strategy" in order to compute a
put-away location using storage types.
Moreover, this module implements "storage type put-away strategy" in
order to compute a put-away location using storage types.

The standard put-away strategy is applied *before* the storage type put-away
strategy as the former relies on product or product category and the latter
relies on stock packages.
The standard put-away strategy is applied *before* the storage type
put-away strategy as the former relies on product or product category
and the latter relies on stock packages.

In other words, when a move is assigned, Odoo standard put-away strategy will be
applied to compute a new destination on the stock move lines, according to the
product.
After this first "put-away computation", the "storage type" put-away strategy
is applied, if the reserved quant is linked to a package defining a package
storage type.
In other words, when a move is assigned, Odoo standard put-away strategy
will be applied to compute a new destination on the stock move lines,
according to the product. After this first "put-away computation", the
"storage type" put-away strategy is applied, if the reserved quant is
linked to a package defining a package storage type.

Storage locations linked to the package storage are processed sequentially, if
said storage location is a child of the move line's destination location (i.e
either the put-away location or the move's destination location).
For each location, their packs storage strategy is applied as well as the
restrictions defined on the stock location storage types.
If no suitable location is found, the next location in the sequence will be
searched and so on.
Storage locations linked to the package storage are processed
sequentially, if said storage location is a child of the move line's
destination location (i.e either the put-away location or the move's
destination location). For each location, their packs storage strategy
is applied as well as the restrictions defined on the stock location
storage types. If no suitable location is found, the next location in
the sequence will be searched and so on.

For the packs putaway strategy "none", the location is considered as is. For
the "ordered children" strategy, children locations are sorted by first by max
height which is a physical constraint to respect, then pack putaway sequence
which allow to favor for example some level or corridor, and finally by name.
For the packs putaway strategy "none", the location is considered as is.
For the "ordered children" strategy, children locations are sorted by
first by max height which is a physical constraint to respect, then pack
putaway sequence which allow to favor for example some level or
corridor, and finally by name.

At the end, if found location is not the same as the original destination location,
the putaway strategies are applied (e.g.: A "none" pack putaway strategy is set on
computed location and a putaway rule exists on that one).
At the end, if found location is not the same as the original
destination location, the putaway strategies are applied (e.g.: A "none"
pack putaway strategy is set on computed location and a putaway rule
exists on that one).

**Table of contents**

Expand All @@ -88,82 +90,88 @@ computed location and a putaway rule exists on that one).
Known issues / Roadmap
======================

Currently, the module supports only strategies applied on packages (``stock.quant.package``).
For implementations that do not use packages, it would be possible to add
compatibility with product packaging.
Currently, the module supports only strategies applied on packages
(``stock.quant.package``). For implementations that do not use packages,
it would be possible to add compatibility with product packaging.

The information needed from a package are:

* the storage type, to know which strategy is applied
* the dimensions and weight, to apply constraints
- the storage type, to know which strategy is applied
- the dimensions and weight, to apply constraints

If we want to support product packaging, we would need to:

* guess the product packaging of a move line based on the product and quantities
(multiple of a packaging quantity, for instance 8000 would be a pallet if the pallet
has 2000 units, 1900 would be Box if the Box has 100 units)
* from the product packaging, we know the storage type and dimensions
- guess the product packaging of a move line based on the product and
quantities (multiple of a packaging quantity, for instance 8000 would
be a pallet if the pallet has 2000 units, 1900 would be Box if the Box
has 100 units)
- from the product packaging, we know the storage type and dimensions

Everywhere the module is using ``package_id``, we would have to check this:
Everywhere the module is using ``package_id``, we would have to check
this:

* use the package if a package is set
* else, use the computed packaging
- use the package if a package is set
- else, use the computed packaging

About Unit of Measures:

In v13, there is an assumption of height to be expressed in mm and weight in kg.
In v14, packaging can be expressed in differents units. Explicit fields are introduced
like max_weight_in_kg in order make simple and efficient computations.

In v13, there is an assumption of height to be expressed in mm and
weight in kg. In v14, packaging can be expressed in differents units.
Explicit fields are introduced like max_weight_in_kg in order make
simple and efficient computations.

Limitation
==========
----------

If the locations structure is using views intensively in order to separate
storage types kindly (not mixing them), Odoo standard method to get putaway
strategy is returning the first child if a move location destination is a view.
If the locations structure is using views intensively in order to
separate storage types kindly (not mixing them), Odoo standard method to
get putaway strategy is returning the first child if a move location
destination is a view.

This is not convenient if we want to set specific strategies on that view. So,
we override standard process by returning the view itself (if no putaway is set).
This is not convenient if we want to set specific strategies on that
view. So, we override standard process by returning the view itself (if
no putaway is set).

This can lead to a change on standard behavior as people will need to change manually
the location destination for pickings with views as default destination.
This can lead to a change on standard behavior as people will need to
change manually the location destination for pickings with views as
default destination.

Idea: maybe adding a field on view locations to say 'this is a view but don't
apply standard child location selection' could help filtering view candidates.
Idea: maybe adding a field on view locations to say 'this is a view but
don't apply standard child location selection' could help filtering view
candidates.

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:%20stock_storage_type%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/wms/issues/new?body=module:%20stock_storage_type%0Aversion:%2017.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

Contributors
~~~~~~~~~~~~
------------

* Akim Juillerat <[email protected]>
* Guewen Baconnier <[email protected]>
* Raphaël Reverdy <[email protected]>
* Jacques-Etienne Baudoux <[email protected]>
* Laurent Mignon <[email protected]>
* Fernando La Chica - GreenICe <[email protected]>
* Denis Roussel <[email protected]>
- Akim Juillerat <[email protected]>
- Guewen Baconnier <[email protected]>
- Raphaël Reverdy <[email protected]>
- Jacques-Etienne Baudoux <[email protected]>
- Laurent Mignon <[email protected]>
- Fernando La Chica - GreenICe <[email protected]>
- Denis Roussel <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -186,6 +194,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-jbaudoux| |maintainer-rousseldenis|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 0 additions & 1 deletion stock_storage_type/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ProductTemplate(models.Model):

_inherit = "product.template"

package_type_id = fields.Many2one(
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class StockLocation(models.Model):

_inherit = "stock.location"

computed_storage_category_id = fields.Many2one(
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_package_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class StockPackageLevel(models.Model):

_inherit = "stock.package_level"

# We use a domain with the module 'web_domain_field', because if we use a
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_package_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class StockPackageType(models.Model):

_inherit = "stock.package.type"

product_packaging_ids = fields.One2many("product.packaging", "package_type_id")
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class StockQuant(models.Model):

_inherit = "stock.quant"

@api.constrains("package_id", "location_id", "lot_id", "product_id")
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_quant_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class StockQuantPackage(models.Model):

_inherit = "stock.quant.package"

pack_weight_in_kg = fields.Float(
Expand Down
1 change: 0 additions & 1 deletion stock_storage_type/models/stock_storage_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class StockStorageCategory(models.Model):

_inherit = "stock.storage.category"

allow_new_product = fields.Selection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class StorageCategoryProductCapacity(models.Model):

_inherit = "stock.storage.category.capacity"

allow_new_product = fields.Selection(
Expand Down
3 changes: 1 addition & 2 deletions stock_storage_type/models/stock_storage_location_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class StockStorageLocationSequence(models.Model):

_name = "stock.storage.location.sequence"
_description = "Sequence of locations to put-away the package storage type"
_order = "sequence"
Expand Down Expand Up @@ -73,7 +72,7 @@ def button_show_locations(self):
xmlid = "stock.action_location_form"
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
action["domain"] = [
("parent_path", "=ilike", "{}%".format(self.location_id.parent_path)),
("parent_path", "=ilike", f"{self.location_id.parent_path}%"),
(
"computed_storage_capacity_ids",
"in",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class StockStorageLocationSequenceCond(models.Model):

_name = "stock.storage.location.sequence.cond"
_description = "Stock Storage Location Sequence Condition"

Expand Down
3 changes: 3 additions & 0 deletions stock_storage_type/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
7 changes: 7 additions & 0 deletions stock_storage_type/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Akim Juillerat \<[email protected]\>
- Guewen Baconnier \<[email protected]\>
- Raphaël Reverdy \<[email protected]\>
- Jacques-Etienne Baudoux \<[email protected]\>
- Laurent Mignon \<[email protected]\>
- Fernando La Chica - GreenICe \<[email protected]\>
- Denis Roussel \<[email protected]\>
7 changes: 0 additions & 7 deletions stock_storage_type/readme/CONTRIBUTORS.rst

This file was deleted.

Loading

0 comments on commit e5c91e8

Please sign in to comment.