forked from OCA/stock-logistics-warehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] stock_picking_volume_packaging
This addon takes care of product packaging into the computation of move's volume
- Loading branch information
Showing
15 changed files
with
738 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_picking_volume_packaging/odoo/addons/stock_picking_volume_packaging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_picking_volume_packaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
=================================== | ||
Stock Picking Volume From Packaging | ||
=================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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--warehouse-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16/stock_picking_volume_packaging | ||
: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-16/stock-logistics-warehouse-16-stock_picking_volume_packaging | ||
: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/16 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This modules improves the way the volume is computed on a stock.move by | ||
taking into account the volume of the potential product packaging | ||
that can be picked to fulfill the move. | ||
|
||
The potential packaging that can be picked for a move are computed by the | ||
module *stock_packaging_calculator*. Thanks to this module we can compute the | ||
best distribution of the packaging to uses to fulfill a specific quantity of a | ||
product. (This information is important for the picking operators to minimize | ||
the number of manipulations to do. Even if this information is not available | ||
into the Odoo UI, The *Shopfloor* addon takes advantage of it to propose | ||
the best picking strategy to the user). | ||
|
||
By default the volume information is not available on the product packaging. | ||
Hopefully the module *product_packaging_dimension* provides this information. | ||
|
||
Since the volume information is not a mandatory field on the product packaging | ||
when we ask for the best distribution of the packaging, packaging without volume | ||
information are ignored. In this way we ensure that the volume of the packaging | ||
is only taken into account when it's relevant otherwise we fallback on the | ||
volume of the products. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
This modules makes sense only if you manage the volume information on | ||
your product packaging definitions. If you don't, you can ignore this module. | ||
|
||
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_picking_volume_packaging%0Aversion:%2016%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 | ||
~~~~~~~ | ||
|
||
* ACSONE SA/NV | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Laurent Mignon <[email protected]> (http://acsone.eu) | ||
* Guewen Baconnier <[email protected]) (http://www.camptocamp.com) | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The development of this module has been financially supported by: | ||
|
||
* ACSONE SA/NV | ||
* Alcyon Benelux | ||
* Camptocamp | ||
|
||
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/16/stock_picking_volume_packaging>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Picking Volume From Packaging", | ||
"summary": """ | ||
Use volume information on potential product packaging to compute the | ||
volume of a stock.move""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-warehouse", | ||
"depends": [ | ||
"stock_picking_volume", | ||
"stock_packaging_calculator", | ||
"product_packaging_dimension", | ||
], | ||
"data": [], | ||
"demo": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2020-2022 Camptocamp SA | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockMove(models.Model): | ||
|
||
_inherit = "stock.move" | ||
|
||
def _get_volume_for_qty(self, qty): | ||
self.ensure_one() | ||
product = self.product_id | ||
if not product.packaging_ids.filtered("volume"): | ||
return super()._get_volume_for_qty(qty=qty) | ||
packagings_with_volume = product.with_context( | ||
_packaging_filter=lambda p: p.volume | ||
).product_qty_by_packaging(qty) | ||
volume = 0 | ||
for packaging_info in packagings_with_volume: | ||
if packaging_info.get("is_unit"): | ||
pack_volume = product.volume | ||
else: | ||
packaging = self.env["product.packaging"].browse(packaging_info["id"]) | ||
pack_volume = packaging.volume | ||
|
||
volume += pack_volume * packaging_info["qty"] | ||
return volume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Laurent Mignon <[email protected]> (http://acsone.eu) | ||
* Guewen Baconnier <[email protected]) (http://www.camptocamp.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The development of this module has been financially supported by: | ||
|
||
* ACSONE SA/NV | ||
* Alcyon Benelux | ||
* Camptocamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
This modules improves the way the volume is computed on a stock.move by | ||
taking into account the volume of the potential product packaging | ||
that can be picked to fulfill the move. | ||
|
||
The potential packaging that can be picked for a move are computed by the | ||
module *stock_packaging_calculator*. Thanks to this module we can compute the | ||
best distribution of the packaging to uses to fulfill a specific quantity of a | ||
product. (This information is important for the picking operators to minimize | ||
the number of manipulations to do. Even if this information is not available | ||
into the Odoo UI, The *Shopfloor* addon takes advantage of it to propose | ||
the best picking strategy to the user). | ||
|
||
By default the volume information is not available on the product packaging. | ||
Hopefully the module *product_packaging_dimension* provides this information. | ||
|
||
Since the volume information is not a mandatory field on the product packaging | ||
when we ask for the best distribution of the packaging, packaging without volume | ||
information are ignored. In this way we ensure that the volume of the packaging | ||
is only taken into account when it's relevant otherwise we fallback on the | ||
volume of the products. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This modules makes sense only if you manage the volume information on | ||
your product packaging definitions. If you don't, you can ignore this module. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.