Skip to content

Commit ad6c9ff

Browse files
committed
[ADD] stock_picking_volume_packaging
This addon takes care of product packaging into the computation of move's volume
1 parent 0c39a66 commit ad6c9ff

File tree

15 files changed

+738
-0
lines changed

15 files changed

+738
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_picking_volume_packaging
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
===================================
2+
Stock Picking Volume From Packaging
3+
===================================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
17+
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16/stock_picking_volume_packaging
18+
:alt: OCA/stock-logistics-warehouse
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16/stock-logistics-warehouse-16-stock_picking_volume_packaging
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/153/16
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This modules improves the way the volume is computed on a stock.move by
29+
taking into account the volume of the potential product packaging
30+
that can be picked to fulfill the move.
31+
32+
The potential packaging that can be picked for a move are computed by the
33+
module *stock_packaging_calculator*. Thanks to this module we can compute the
34+
best distribution of the packaging to uses to fulfill a specific quantity of a
35+
product. (This information is important for the picking operators to minimize
36+
the number of manipulations to do. Even if this information is not available
37+
into the Odoo UI, The *Shopfloor* addon takes advantage of it to propose
38+
the best picking strategy to the user).
39+
40+
By default the volume information is not available on the product packaging.
41+
Hopefully the module *product_packaging_dimension* provides this information.
42+
43+
Since the volume information is not a mandatory field on the product packaging
44+
when we ask for the best distribution of the packaging, packaging without volume
45+
information are ignored. In this way we ensure that the volume of the packaging
46+
is only taken into account when it's relevant otherwise we fallback on the
47+
volume of the products.
48+
49+
**Table of contents**
50+
51+
.. contents::
52+
:local:
53+
54+
Usage
55+
=====
56+
57+
This modules makes sense only if you manage the volume information on
58+
your product packaging definitions. If you don't, you can ignore this module.
59+
60+
Bug Tracker
61+
===========
62+
63+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
64+
In case of trouble, please check there if your issue has already been reported.
65+
If you spotted it first, help us smashing it by providing a detailed and welcomed
66+
`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**>`_.
67+
68+
Do not contact contributors directly about support or help with technical issues.
69+
70+
Credits
71+
=======
72+
73+
Authors
74+
~~~~~~~
75+
76+
* ACSONE SA/NV
77+
78+
Contributors
79+
~~~~~~~~~~~~
80+
81+
* Laurent Mignon <laurent.mignon@acsone.eu> (http://acsone.eu)
82+
* Guewen Baconnier <guewen.baconnier@camptocamp.eu) (http://www.camptocamp.com)
83+
84+
Other credits
85+
~~~~~~~~~~~~~
86+
87+
The development of this module has been financially supported by:
88+
89+
* ACSONE SA/NV
90+
* Alcyon Benelux
91+
* Camptocamp
92+
93+
Maintainers
94+
~~~~~~~~~~~
95+
96+
This module is maintained by the OCA.
97+
98+
.. image:: https://odoo-community.org/logo.png
99+
:alt: Odoo Community Association
100+
:target: https://odoo-community.org
101+
102+
OCA, or the Odoo Community Association, is a nonprofit organization whose
103+
mission is to support the collaborative development of Odoo features and
104+
promote its widespread use.
105+
106+
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.
107+
108+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Picking Volume From Packaging",
6+
"summary": """
7+
Use volume information on potential product packaging to compute the
8+
volume of a stock.move""",
9+
"version": "16.0.1.0.0",
10+
"license": "AGPL-3",
11+
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/stock-logistics-warehouse",
13+
"depends": [
14+
"stock_picking_volume",
15+
"stock_packaging_calculator",
16+
"product_packaging_dimension",
17+
],
18+
"data": [],
19+
"demo": [],
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import stock_move
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2020-2022 Camptocamp SA
2+
# Copyright 2023 ACSONE SA/NV
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
from odoo import models
6+
7+
8+
class StockMove(models.Model):
9+
10+
_inherit = "stock.move"
11+
12+
def _get_volume_for_qty(self, qty):
13+
self.ensure_one()
14+
product = self.product_id
15+
if not product.packaging_ids.filtered("volume"):
16+
return super()._get_volume_for_qty(qty=qty)
17+
packagings_with_volume = product.with_context(
18+
_packaging_filter=lambda p: p.volume
19+
).product_qty_by_packaging(qty)
20+
volume = 0
21+
for packaging_info in packagings_with_volume:
22+
if packaging_info.get("is_unit"):
23+
pack_volume = product.volume
24+
else:
25+
packaging = self.env["product.packaging"].browse(packaging_info["id"])
26+
pack_volume = packaging.volume
27+
28+
volume += pack_volume * packaging_info["qty"]
29+
return volume
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Laurent Mignon <laurent.mignon@acsone.eu> (http://acsone.eu)
2+
* Guewen Baconnier <guewen.baconnier@camptocamp.eu) (http://www.camptocamp.com)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The development of this module has been financially supported by:
2+
3+
* ACSONE SA/NV
4+
* Alcyon Benelux
5+
* Camptocamp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This modules improves the way the volume is computed on a stock.move by
2+
taking into account the volume of the potential product packaging
3+
that can be picked to fulfill the move.
4+
5+
The potential packaging that can be picked for a move are computed by the
6+
module *stock_packaging_calculator*. Thanks to this module we can compute the
7+
best distribution of the packaging to uses to fulfill a specific quantity of a
8+
product. (This information is important for the picking operators to minimize
9+
the number of manipulations to do. Even if this information is not available
10+
into the Odoo UI, The *Shopfloor* addon takes advantage of it to propose
11+
the best picking strategy to the user).
12+
13+
By default the volume information is not available on the product packaging.
14+
Hopefully the module *product_packaging_dimension* provides this information.
15+
16+
Since the volume information is not a mandatory field on the product packaging
17+
when we ask for the best distribution of the packaging, packaging without volume
18+
information are ignored. In this way we ensure that the volume of the packaging
19+
is only taken into account when it's relevant otherwise we fallback on the
20+
volume of the products.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This modules makes sense only if you manage the volume information on
2+
your product packaging definitions. If you don't, you can ignore this module.
Loading

0 commit comments

Comments
 (0)