Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions sale_stock_warehouse_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=============================
Sale Stock Warehouse Partner
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:de3c18851f1aba0fd3b4d24d2b34e1ee02c19e9bf3386c157e288e1b72e83a95
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/15.0/sale_stock_warehouse_partner
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_stock_warehouse_partner
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows setting a **warehouse** on partner records and applies
a priority sequence when creating a Sale Order. If the warehouse is defined
at a higher-priority level, it will override the lower ones. Priority are defined
following next order: `partner_shipping_id`, `partner_id` and last `user_id`.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

When creating a sale order, the system will automatically assign the warehouse
according to the above sequence. Changing the customer, delivery address,
salesperson will re-trigger the warehouse selection.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`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**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa
* Odoo SA

Contributors
~~~~~~~~~~~~

- [Tecnativa](https://www.tecnativa.com):
- Eduardo Ezerouali

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

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.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_stock_warehouse_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2025 Tecnativa - Eduardo Ezerouali
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from . import models
16 changes: 16 additions & 0 deletions sale_stock_warehouse_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Tecnativa - Eduardo Ezerouali
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Sale Stock Warehouse Partner ",
"summary": "Allows to set a warehouse to a partner",
"version": "15.0.1.0.0",
"development_status": "Alpha",
"category": "Sales",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA), Odoo SA",
"license": "AGPL-3",
"depends": ["sale_stock"],
"data": [
"views/res_partner_views.xml",
],
}
5 changes: 5 additions & 0 deletions sale_stock_warehouse_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2025 Tecnativa - Eduardo Ezerouali
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from . import res_partner
from . import sale_order
15 changes: 15 additions & 0 deletions sale_stock_warehouse_partner/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 Tecnativa - Eduardo Ezerouali
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

sale_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse",
company_dependent=True,
string="Warehouse",
help="Set default warehouse for Sale Order",
)
27 changes: 27 additions & 0 deletions sale_stock_warehouse_partner/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2025 Tecnativa - Eduardo Ezerouali
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import api, fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

warehouse_id = fields.Many2one(
"stock.warehouse",
string="Warehouse",
required=True,
readonly=True,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
compute="_compute_warehouse_id",
store=True,
check_company=True,
)

@api.depends("partner_shipping_id", "partner_id")
def _compute_warehouse_id(self):
for order in self:
if order.partner_shipping_id.sale_warehouse_id:
order.warehouse_id = order.partner_shipping_id.sale_warehouse_id
elif order.partner_id.sale_warehouse_id:
order.warehouse_id = order.partner_id.sale_warehouse_id
2 changes: 2 additions & 0 deletions sale_stock_warehouse_partner/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Tecnativa](https://www.tecnativa.com):
- Eduardo Ezerouali
4 changes: 4 additions & 0 deletions sale_stock_warehouse_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module allows setting a **warehouse** on partner records and applies
a priority sequence when creating a Sale Order. If the warehouse is defined
at a higher-priority level, it will override the lower ones. Priority are defined
following next order: `partner_shipping_id`, `partner_id` and last `user_id`.
3 changes: 3 additions & 0 deletions sale_stock_warehouse_partner/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
When creating a sale order, the system will automatically assign the warehouse
according to the above sequence. Changing the customer, delivery address,
salesperson will re-trigger the warehouse selection.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading