Skip to content

Commit cea8bf7

Browse files
committed
[17.0][ADD] stock_picking_carrier: Setting the shipping method automatically according to the receiving origin in the picking
1 parent d9f39a9 commit cea8bf7

22 files changed

+884
-0
lines changed

stock_picking_carrier/README.rst

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
=====================
2+
Stock Picking Carrier
3+
=====================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:90b8ff4b2dfdba96bc810968c0ce61efa54c512d6abea98421992e2442873c49
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/17.0/stock_picking_carrier
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-17-0/stock-logistics-workflow-17-0-stock_picking_carrier
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=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows you to complete the Carrier field during picking, if
32+
the partner has previously associated a shipping method.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Configuration
40+
=============
41+
42+
Configure auto assign carrier:
43+
------------------------------
44+
45+
1. Go to Inventory > Configuration > Settings > Section Shipping
46+
47+
2. Find "Carrier auto assign" and enable it
48+
49+
|ENABLE_AUTO_ASSIGN_CARRIER|
50+
51+
.. |ENABLE_AUTO_ASSIGN_CARRIER| image:: https://raw.githubusercontent.com/OCA/stock-logistics-workflow/17.0/stock_picking_carrier/static/img/readme/enable_auto_assign_carrier.png
52+
53+
Usage
54+
=====
55+
56+
Configure shipping method in the contact
57+
----------------------------------------
58+
59+
1. Go to Contacts or any other menu to access contacts.
60+
2. Select the contact you want to configure the shipping method.
61+
3. Go to the tab "Sales & Purchases" and select the shipping method.
62+
63+
|SHIPPING_METHOD_CONTACT|
64+
65+
Set shipping method on the picking
66+
----------------------------------
67+
68+
1. Go to Inventory > Operations > Receipts
69+
70+
2. Create a new picking
71+
72+
3. Select the Receive From and the Shipping Method field will
73+
automatically be filled in on the Additional Information tab.
74+
75+
|SHIPPING_METHOD_PICKING|
76+
77+
Set shipping method when creating a sales order
78+
-----------------------------------------------
79+
80+
1. Go to Sales > Orders > Quotations
81+
82+
2. Create a new sale order
83+
84+
3. Add the partner, lines, and other necessary data, then confirm the
85+
sales order.
86+
87+
4. A picking will be created with the Carrier configured in the partner
88+
selected in the sales order.
89+
90+
|SALE_SHIPPING_METHOD_PICKING|
91+
92+
.. |SHIPPING_METHOD_CONTACT| image:: https://raw.githubusercontent.com/OCA/stock-logistics-workflow/17.0/stock_picking_carrier/static/img/readme/configure_shipping_method_contact.png
93+
.. |SHIPPING_METHOD_PICKING| image:: https://raw.githubusercontent.com/OCA/stock-logistics-workflow/17.0/stock_picking_carrier/static/img/readme/configure_shipping_method_picking.png
94+
.. |SALE_SHIPPING_METHOD_PICKING| image:: https://raw.githubusercontent.com/OCA/stock-logistics-workflow/17.0/stock_picking_carrier/static/img/readme/configure_sale_shipping_method_picking.png
95+
96+
Bug Tracker
97+
===========
98+
99+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
100+
In case of trouble, please check there if your issue has already been reported.
101+
If you spotted it first, help us to smash it by providing a detailed and welcomed
102+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_carrier%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
103+
104+
Do not contact contributors directly about support or help with technical issues.
105+
106+
Credits
107+
=======
108+
109+
Authors
110+
-------
111+
112+
* Binhex
113+
114+
Contributors
115+
------------
116+
117+
[Binhex] (https://www.binhex.cloud):
118+
119+
- Edilio Escalona Almira [email protected]
120+
121+
Maintainers
122+
-----------
123+
124+
This module is maintained by the OCA.
125+
126+
.. image:: https://odoo-community.org/logo.png
127+
:alt: Odoo Community Association
128+
:target: https://odoo-community.org
129+
130+
OCA, or the Odoo Community Association, is a nonprofit organization whose
131+
mission is to support the collaborative development of Odoo features and
132+
promote its widespread use.
133+
134+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_picking_carrier>`_ project on GitHub.
135+
136+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

stock_picking_carrier/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 Binhex <https://www.binhex.cloud>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import wizard
5+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Binhex <https://www.binhex.cloud>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Picking Carrier",
6+
"version": "17.0.1.0.0",
7+
"author": "Binhex, Odoo Community Association (OCA)",
8+
"category": "Inventory/Delivery",
9+
"website": "https://github.com/OCA/stock-logistics-workflow",
10+
"depends": ["stock_delivery"],
11+
"data": [
12+
"wizard/res_config_settings_views.xml",
13+
],
14+
"installable": True,
15+
"license": "AGPL-3",
16+
}

stock_picking_carrier/i18n/es.po

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * stock_picking_carrier
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-10-27 15:09+0000\n"
10+
"PO-Revision-Date: 2025-10-27 15:09+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: stock_picking_carrier
19+
#: model_terms:ir.ui.view,arch_db:stock_picking_carrier.res_config_settings_view_form
20+
msgid ""
21+
"Automatically assign the delivery carrier when creating a picking or when "
22+
"selecting a partner in a created one."
23+
msgstr "Asignar automáticamente el transportista de entrega al crear un picking o al seleccionar un partner en uno creado."
24+
25+
#. module: stock_picking_carrier
26+
#: model:ir.model.fields,field_description:stock_picking_carrier.field_res_config_settings__carrier_auto_assign_picking
27+
msgid "Carrier auto assign"
28+
msgstr "Asignación automática de transportista"
29+
30+
#. module: stock_picking_carrier
31+
#: model:ir.model,name:stock_picking_carrier.model_res_config_settings
32+
msgid "Config Settings"
33+
msgstr "Ajustes de configuración"
34+
35+
#. module: stock_picking_carrier
36+
#: model:ir.model,name:stock_picking_carrier.model_stock_picking
37+
msgid "Transfer"
38+
msgstr "Traslado"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Binhex <https://www.binhex.cloud>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import stock_picking
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2025 Binhex <https://www.binhex.cloud>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class StockPicking(models.Model):
8+
_inherit = "stock.picking"
9+
10+
@api.model_create_multi
11+
def create(self, vals):
12+
ResPartner = self.env["res.partner"]
13+
carrier_auto_assign = (
14+
self.env["ir.config_parameter"]
15+
.sudo()
16+
.get_param("stock_picking_carrier.carrier_auto_assign_picking")
17+
)
18+
if carrier_auto_assign:
19+
for val in vals:
20+
if "partner_id" in val:
21+
val["carrier_id"] = ResPartner.browse(
22+
val["partner_id"]
23+
).property_delivery_carrier_id.id
24+
return super().create(vals)
25+
26+
@api.onchange("partner_id")
27+
def _onchange_partner_id(self):
28+
carrier_auto_assign = (
29+
self.env["ir.config_parameter"]
30+
.sudo()
31+
.get_param("stock_picking_carrier.carrier_auto_assign_picking")
32+
)
33+
if carrier_auto_assign:
34+
for picking in self:
35+
if picking.partner_id:
36+
picking.carrier_id = (
37+
picking.partner_id.property_delivery_carrier_id.id
38+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Configure auto assign carrier:
2+
---------------------
3+
4+
1. Go to Inventory > Configuration > Settings > Section Shipping
5+
2. Find "Carrier auto assign" and enable it
6+
7+
![ENABLE_AUTO_ASSIGN_CARRIER](../static/img/readme/enable_auto_assign_carrier.png)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Binhex] (https://www.binhex.cloud):
2+
- Edilio Escalona Almira <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows you to complete the Carrier field during picking, if the partner has previously associated a shipping method.

0 commit comments

Comments
 (0)