Skip to content

Commit e0e850f

Browse files
committed
[16.0][ADD] stock_picking_operation_destination_suggestion
1 parent f376165 commit e0e850f

File tree

24 files changed

+1123
-0
lines changed

24 files changed

+1123
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_picking_operation_destination_suggestion
Lines changed: 6 additions & 0 deletions
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+
)
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
==============================================
2+
Stock Picking Operation Destination Suggestion
3+
==============================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:3a5e5b637a9800b468f6131baf87f4a073dd96d577b052d9fd4fde3a7905ab99
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_operation_destination_suggestion
21+
:alt: OCA/stock-logistics-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_operation_destination_suggestion
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to suggest on picking level a destination location
32+
based on already transferred ones (and so, on next picking).
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Use Cases / Context
40+
===================
41+
42+
In order to identify more accurately source of packages/products for
43+
deliveries in Output location, it is more convenient to use several sub
44+
locations.
45+
46+
So, when doing the transfer from packaging location to the output ones,
47+
we want to be guided towards the good final location.
48+
49+
A first criteria could be to group pickings by customer.
50+
51+
Configuration
52+
=============
53+
54+
- Go to Inventory > Configuration > Operation Types
55+
- Choose the one you want to activate (e.g.: it should be the operation
56+
just before the delivery).
57+
- Check the 'Suggest Destination' box.
58+
59+
Usage
60+
=====
61+
62+
- When the picking is ready, done quantities on operations.
63+
- Click on 'Suggest Destination'
64+
- Following the suggested destination locations, pick one and Apply.
65+
- The destination location is applied on all selected operations.
66+
67+
Bug Tracker
68+
===========
69+
70+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
71+
In case of trouble, please check there if your issue has already been reported.
72+
If you spotted it first, help us to smash it by providing a detailed and welcomed
73+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_operation_destination_suggestion%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
74+
75+
Do not contact contributors directly about support or help with technical issues.
76+
77+
Credits
78+
=======
79+
80+
Authors
81+
-------
82+
83+
* ACSONE SA/NV
84+
85+
Contributors
86+
------------
87+
88+
- Denis Roussel [email protected]
89+
90+
Maintainers
91+
-----------
92+
93+
This module is maintained by the OCA.
94+
95+
.. image:: https://odoo-community.org/logo.png
96+
:alt: Odoo Community Association
97+
:target: https://odoo-community.org
98+
99+
OCA, or the Odoo Community Association, is a nonprofit organization whose
100+
mission is to support the collaborative development of Odoo features and
101+
promote its widespread use.
102+
103+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_operation_destination_suggestion>`_ project on GitHub.
104+
105+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from . import wizards
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Picking Operation Destination Suggestion",
6+
"summary": """This module allows to show suggestions of
7+
destination locations from different criteria""",
8+
"version": "16.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/stock-logistics-workflow",
12+
"depends": [
13+
"stock",
14+
"stock_location_children",
15+
"stock_location_pending_move",
16+
],
17+
"data": [
18+
"security/security.xml",
19+
"wizards/stock_picking_operation_destination_suggestion.xml",
20+
"views/stock_picking_type.xml",
21+
"views/stock_picking.xml",
22+
],
23+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import stock_picking_type
2+
from . import stock_picking
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from odoo import api, fields, models
4+
from odoo.osv.expression import AND
5+
6+
7+
class StockPicking(models.Model):
8+
9+
_inherit = "stock.picking"
10+
11+
destination_location_suggestion_ids = fields.Many2many(
12+
comodel_name="stock.location",
13+
string="Suggested Destination Locations",
14+
compute="_compute_destination_location_suggestion_ids",
15+
)
16+
suggest_destination_visible = fields.Boolean(
17+
compute="_compute_suggest_destination_visible",
18+
)
19+
20+
@api.depends("state", "picking_type_id.suggest_destination")
21+
def _compute_suggest_destination_visible(self):
22+
for picking in self:
23+
picking.suggest_destination_visible = bool(
24+
picking.state == "assigned"
25+
and picking.picking_type_id.suggest_destination
26+
)
27+
28+
def _get_location_destination_move_line_suggestion_domain(self):
29+
return AND(
30+
[
31+
self.picking_type_id.suggest_destination_additional_domain,
32+
[("picking_id.partner_id", "in", self.partner_id.ids)],
33+
]
34+
)
35+
36+
@api.depends(
37+
"partner_id", "location_dest_id.children_ids.pending_out_move_line_ids"
38+
)
39+
def _compute_destination_location_suggestion_ids(self):
40+
for picking in self:
41+
pending_line_ids = (
42+
picking.location_dest_id.children_ids.pending_out_move_line_ids
43+
)
44+
locations = (
45+
pending_line_ids.filtered_domain(
46+
self._get_location_destination_move_line_suggestion_domain()
47+
).location_id
48+
if picking.picking_type_id.suggest_destination
49+
else self.env["stock.location"].browse()
50+
)
51+
picking.destination_location_suggestion_ids = locations
52+
53+
def suggest_destination(self):
54+
"""
55+
Launch the destination suggestion wizard
56+
"""
57+
action = self.env["ir.actions.act_window"]._for_xml_id(
58+
"stock_picking_operation_destination_suggestion."
59+
"stock_picking_operation_destination_suggest_act_window"
60+
)
61+
return action
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class StockPickingType(models.Model):
8+
9+
_inherit = "stock.picking.type"
10+
11+
suggest_destination = fields.Boolean(
12+
help="Check this is in order to suggest the final destination of operations." ""
13+
)
14+
suggest_destination_partner = fields.Boolean(
15+
help="Check this if you want to suggest destination locations with pending moves"
16+
"with the same partner",
17+
)
18+
suggest_destination_additional_domain = fields.Binary(
19+
help="Set a particular domain to suggest destination locations."
20+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Go to Inventory > Configuration > Operation Types
2+
- Choose the one you want to activate (e.g.: it should be the operation
3+
just before the delivery).
4+
- Check the 'Suggest Destination' box.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
In order to identify more accurately source of packages/products for
2+
deliveries in Output location, it is more convenient to use several
3+
sub locations.
4+
5+
So, when doing the transfer from packaging location to the output ones,
6+
we want to be guided towards the good final location.
7+
8+
A first criteria could be to group pickings by customer.

0 commit comments

Comments
 (0)