Skip to content

Commit

Permalink
Merge PR #3044 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by HaraldPanten
  • Loading branch information
OCA-git-bot committed Sep 19, 2024
2 parents c810b9d + 4d0cea5 commit 2317798
Show file tree
Hide file tree
Showing 16 changed files with 655 additions and 0 deletions.
95 changes: 95 additions & 0 deletions sale_stock_partner_warehouse/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=============================
sale stock partner wharehouse
=============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/16.0/sale_stock_partner_warehouse
: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-16-0/sale-workflow-16-0-sale_stock_partner_warehouse
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/sale-workflow&target_branch=16.0
:alt: Try me on Runboat

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

Allow to choose by default a warehouse on SO based on a Partner parameter.

If the warehouse parameter is completed, then this value would be the default one on the sale.
If empty, then the warehouse on sale would be the standard default warehouse.

.. 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:

Configuration
=============

On the partner, choose the default warehouse.

Create a sale.order with this partner, the default warehouse is the one from the partner.

Usage
=====

You need at least to manage 2 different warehouses.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_stock_partner_warehouse%0Aversion:%2016.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
~~~~~~~

* Camptocamp
* BCIM

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

* Telmo Santos <telmo.santos@camptocamp.com>
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>

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/16.0/sale_stock_partner_warehouse>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_stock_partner_warehouse/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions sale_stock_partner_warehouse/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "sale stock partner wharehouse",
"summary": "Allow to choose by default a warehouse on SO based on a Partner parameter",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/sale-workflow",
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"data": [
"views/partner_view.xml",
],
"depends": [
"sale_stock",
],
}
2 changes: 2 additions & 0 deletions sale_stock_partner_warehouse/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import res_partner
from . import sale_order
10 changes: 10 additions & 0 deletions sale_stock_partner_warehouse/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 Camptocamp SA
# 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("stock.warehouse", string="Sale Warehouse")
23 changes: 23 additions & 0 deletions sale_stock_partner_warehouse/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Camptocamp SA
# 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(
compute="_compute_warehouse_id", store=True, precompute=True
)

@api.depends("partner_id")
def _compute_warehouse_id(self):
sales_with_partner_warehouse = self.filtered(
lambda sale: sale.state == "draft" and sale.partner_id.sale_warehouse_id
)
for sale in sales_with_partner_warehouse:
sale.warehouse_id = sale.partner_id.sale_warehouse_id
return super(
SaleOrder, self - sales_with_partner_warehouse
)._compute_warehouse_id()
3 changes: 3 additions & 0 deletions sale_stock_partner_warehouse/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
On the partner, choose the default warehouse.

Create a sale.order with this partner, the default warehouse is the one from the partner.
2 changes: 2 additions & 0 deletions sale_stock_partner_warehouse/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Telmo Santos <telmo.santos@camptocamp.com>
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
4 changes: 4 additions & 0 deletions sale_stock_partner_warehouse/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Allow to choose by default a warehouse on SO based on a Partner parameter.

If the warehouse parameter is completed, then this value would be the default one on the sale.
If empty, then the warehouse on sale would be the standard default warehouse.
1 change: 1 addition & 0 deletions sale_stock_partner_warehouse/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You need at least to manage 2 different warehouses.
Loading

0 comments on commit 2317798

Please sign in to comment.