Skip to content

Commit 3088ac0

Browse files
[ADD] sale_stock_warehouse_partner: New module
1 parent 7b6888d commit 3088ac0

16 files changed

Lines changed: 810 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
=============================
2+
Sale Stock Warehouse Partenr
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 extends the functionality of stock secondary unit module and
32+
sale_order_secondary_unit to allow copy secondary sale data to stock move when
33+
a sale order is confirmed.
34+
35+
.. IMPORTANT::
36+
This is an alpha version, the data model and design can change at any time without warning.
37+
Only for development or testing purpose, do not use in production.
38+
`More details on development status <https://odoo-community.org/page/development-status>`_
39+
40+
**Table of contents**
41+
42+
.. contents::
43+
:local:
44+
45+
Usage
46+
=====
47+
48+
When creating a sale order, the system will automatically assign the warehouse
49+
according to the above sequence. Changing the customer, delivery address,
50+
salesperson, or order type will re-trigger the warehouse selection.
51+
52+
Bug Tracker
53+
===========
54+
55+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
56+
In case of trouble, please check there if your issue has already been reported.
57+
If you spotted it first, help us to smash it by providing a detailed and welcomed
58+
`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**>`_.
59+
60+
Do not contact contributors directly about support or help with technical issues.
61+
62+
Credits
63+
=======
64+
65+
Authors
66+
~~~~~~~
67+
68+
* Tecnativa
69+
* Odoo SA
70+
71+
Contributors
72+
~~~~~~~~~~~~
73+
74+
- [Tecnativa](https://www.tecnativa.com):
75+
- Eduardo Ezerouali
76+
77+
Maintainers
78+
~~~~~~~~~~~
79+
80+
This module is maintained by the OCA.
81+
82+
.. image:: https://odoo-community.org/logo.png
83+
:alt: Odoo Community Association
84+
:target: https://odoo-community.org
85+
86+
OCA, or the Odoo Community Association, is a nonprofit organization whose
87+
mission is to support the collaborative development of Odoo features and
88+
promote its widespread use.
89+
90+
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.
91+
92+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Teacnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Teacnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
{
4+
"name": "Sale Stock Warehouse Partenr ",
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", "contacts", "sale_order_type"],
13+
"data": [
14+
"views/sale_order_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 Teacnativa - 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2025 Teacnativa - 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+
warehouse_id = fields.Many2one(comodel_name="stock.warehouse", string="Warehouse")
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright 2025 Teacnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from odoo import api, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
@api.onchange("partner_shipping_id")
11+
def _onchange_partner_shipping_id(self):
12+
for order in self:
13+
order.warehouse_id = order.get_warehouse_id()
14+
15+
@api.onchange("partner_id")
16+
def onchange_partner_id(self):
17+
res = super().onchange_partner_id()
18+
for order in self:
19+
order.warehouse_id = order.get_warehouse_id()
20+
return res
21+
22+
@api.onchange("type_id")
23+
def onchange_type_id(self):
24+
res = super().onchange_type_id()
25+
for order in self:
26+
order.warehouse_id = order.get_warehouse_id()
27+
return res
28+
29+
@api.onchange("user_id")
30+
def onchange_user_id(self):
31+
res = super().onchange_user_id()
32+
for order in self:
33+
order.warehouse_id = order.get_warehouse_id()
34+
return res
35+
36+
def get_warehouse_id(self):
37+
if self.partner_shipping_id.warehouse_id:
38+
return self.partner_shipping_id.warehouse_id
39+
elif self.partner_id.warehouse_id:
40+
return self.partner_id.warehouse_id
41+
elif self.user_id.warehouse_id:
42+
return self.user_id.warehouse_id
43+
elif self.type_id.warehouse_id:
44+
return self.type_id.warehouse_id
45+
else:
46+
return self.env["stock.warehouse"].search(
47+
[("company_id", "=", self.env.company.id)], limit=1
48+
)
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This module extends the functionality of stock secondary unit module and
2+
sale_order_secondary_unit to allow copy secondary sale data to stock move when
3+
a sale order is confirmed.
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, or order type will re-trigger the warehouse selection.
9.23 KB
Loading

0 commit comments

Comments
 (0)