Skip to content

Commit 826be3d

Browse files
committed
Merge PR #3916 into 15.0
Signed-off-by pedrobaeza
2 parents 4477104 + a59b876 commit 826be3d

16 files changed

Lines changed: 767 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
=============================
2+
Sale Stock Warehouse Partner
3+
=============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:de3c18851f1aba0fd3b4d24d2b34e1ee02c19e9bf3386c157e288e1b72e83a95
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
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%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/15.0/sale_stock_warehouse_partner
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_stock_warehouse_partner
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/sale-workflow&target_branch=15.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows setting a **warehouse** on partner records and applies
32+
a priority sequence when creating a Sale Order. If the warehouse is defined
33+
at a higher-priority level, it will override the lower ones. Priority are defined
34+
following next order: `partner_shipping_id`, `partner_id` and last `user_id`.
35+
36+
.. IMPORTANT::
37+
This is an alpha version, the data model and design can change at any time without warning.
38+
Only for development or testing purpose, do not use in production.
39+
`More details on development status <https://odoo-community.org/page/development-status>`_
40+
41+
**Table of contents**
42+
43+
.. contents::
44+
:local:
45+
46+
Usage
47+
=====
48+
49+
When creating a sale order, the system will automatically assign the warehouse
50+
according to the above sequence. Changing the customer, delivery address,
51+
salesperson will re-trigger the warehouse selection.
52+
53+
Bug Tracker
54+
===========
55+
56+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
57+
In case of trouble, please check there if your issue has already been reported.
58+
If you spotted it first, help us to smash it by providing a detailed and welcomed
59+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_stock_warehouse_partner%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
60+
61+
Do not contact contributors directly about support or help with technical issues.
62+
63+
Credits
64+
=======
65+
66+
Authors
67+
~~~~~~~
68+
69+
* Tecnativa
70+
* Odoo SA
71+
72+
Contributors
73+
~~~~~~~~~~~~
74+
75+
- [Tecnativa](https://www.tecnativa.com):
76+
- Eduardo Ezerouali
77+
78+
Maintainers
79+
~~~~~~~~~~~
80+
81+
This module is maintained by the OCA.
82+
83+
.. image:: https://odoo-community.org/logo.png
84+
:alt: Odoo Community Association
85+
:target: https://odoo-community.org
86+
87+
OCA, or the Odoo Community Association, is a nonprofit organization whose
88+
mission is to support the collaborative development of Odoo features and
89+
promote its widespread use.
90+
91+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/15.0/sale_stock_warehouse_partner>`_ project on GitHub.
92+
93+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
{
4+
"name": "Sale Stock Warehouse Partner ",
5+
"summary": "Allows to set a warehouse to a partner",
6+
"version": "15.0.1.0.0",
7+
"development_status": "Alpha",
8+
"category": "Sales",
9+
"website": "https://github.com/OCA/sale-workflow",
10+
"author": "Tecnativa, Odoo Community Association (OCA), Odoo SA",
11+
"license": "AGPL-3",
12+
"depends": ["sale_stock"],
13+
"data": [
14+
"views/res_partner_views.xml",
15+
],
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from . import res_partner
5+
from . import sale_order
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from odoo import fields, models
5+
6+
7+
class ResPartner(models.Model):
8+
_inherit = "res.partner"
9+
10+
sale_warehouse_id = fields.Many2one(
11+
comodel_name="stock.warehouse",
12+
company_dependent=True,
13+
string="Warehouse",
14+
help="Set default warehouse for Sale Order",
15+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from odoo import api, fields, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
warehouse_id = fields.Many2one(
11+
"stock.warehouse",
12+
string="Warehouse",
13+
required=True,
14+
readonly=True,
15+
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
16+
compute="_compute_warehouse_id",
17+
store=True,
18+
check_company=True,
19+
)
20+
21+
@api.depends("partner_shipping_id", "partner_id")
22+
def _compute_warehouse_id(self):
23+
for order in self:
24+
if order.partner_shipping_id.sale_warehouse_id:
25+
order.warehouse_id = order.partner_shipping_id.sale_warehouse_id
26+
elif order.partner_id.sale_warehouse_id:
27+
order.warehouse_id = order.partner_id.sale_warehouse_id
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Tecnativa](https://www.tecnativa.com):
2+
- Eduardo Ezerouali
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This module allows setting a **warehouse** on partner records and applies
2+
a priority sequence when creating a Sale Order. If the warehouse is defined
3+
at a higher-priority level, it will override the lower ones. Priority are defined
4+
following next order: `partner_shipping_id`, `partner_id` and last `user_id`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When creating a sale order, the system will automatically assign the warehouse
2+
according to the above sequence. Changing the customer, delivery address,
3+
salesperson will re-trigger the warehouse selection.
9.23 KB
Loading

0 commit comments

Comments
 (0)