Skip to content

Commit ba9fbab

Browse files
[ADD] sale_stock_warehouse_order_type: New module
1 parent 7b6888d commit ba9fbab

14 files changed

Lines changed: 708 additions & 1 deletion

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
================================
2+
Sale Stock Warehouse Order Type
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_order_type
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_order_type
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 sale_stock_warehouse_partner fuctionallity to control
32+
interactions with sale_order_type.
33+
34+
.. IMPORTANT::
35+
This is an alpha version, the data model and design can change at any time without warning.
36+
Only for development or testing purpose, do not use in production.
37+
`More details on development status <https://odoo-community.org/page/development-status>`_
38+
39+
**Table of contents**
40+
41+
.. contents::
42+
:local:
43+
44+
Bug Tracker
45+
===========
46+
47+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
48+
In case of trouble, please check there if your issue has already been reported.
49+
If you spotted it first, help us to smash it by providing a detailed and welcomed
50+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_stock_warehouse_order_type%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
51+
52+
Do not contact contributors directly about support or help with technical issues.
53+
54+
Credits
55+
=======
56+
57+
Authors
58+
~~~~~~~
59+
60+
* Tecnativa
61+
* Odoo SA
62+
63+
Contributors
64+
~~~~~~~~~~~~
65+
66+
- [Tecnativa](https://www.tecnativa.com):
67+
- Eduardo Ezerouali
68+
69+
Maintainers
70+
~~~~~~~~~~~
71+
72+
This module is maintained by the OCA.
73+
74+
.. image:: https://odoo-community.org/logo.png
75+
:alt: Odoo Community Association
76+
:target: https://odoo-community.org
77+
78+
OCA, or the Odoo Community Association, is a nonprofit organization whose
79+
mission is to support the collaborative development of Odoo features and
80+
promote its widespread use.
81+
82+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/15.0/sale_stock_warehouse_order_type>`_ project on GitHub.
83+
84+
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: 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+
"name": "Sale Stock Warehouse Order Type ",
5+
"summary": "Manage warehouse priority when sale_order_type installed",
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_order_type", "sale_stock_warehouse_partner"],
13+
"auto_install": True,
14+
"installable": True,
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Tecnativa - Eduardo Ezerouali
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
3+
4+
from . import sale_order
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
@api.onchange("type_id")
11+
def onchange_type_id(self):
12+
"""
13+
The order to apply default warehouse in a sale order is
14+
1 - Shipping address
15+
2 - Partner address
16+
4 - Sales Person
17+
3 - Sale order type setting
18+
The inherit method already checks if the sale order type has not warehouse.
19+
"""
20+
res = super(SaleOrder, self).onchange_type_id()
21+
for order in self:
22+
order_type = order.type_id
23+
vals = {}
24+
if order.partner_shipping_id.warehouse_id:
25+
vals.update({"warehouse_id": order.partner_shipping_id.warehouse_id.id})
26+
elif order.partner_id.warehouse_id:
27+
vals.update({"warehouse_id": order.partner_id.warehouse_id.id})
28+
elif order.user_id.property_warehouse_id:
29+
vals.update({"warehouse_id": order.user_id.property_warehouse_id.id})
30+
elif order_type.warehouse_id:
31+
vals.update({"warehouse_id": order_type.warehouse_id.id})
32+
if vals:
33+
order.update(vals)
34+
return res
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module extends sale_stock_warehouse_partner fuctionallity to control
2+
interactions with sale_order_type.
9.23 KB
Loading

0 commit comments

Comments
 (0)