Skip to content

Commit

Permalink
Merge PR #577 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Mar 28, 2024
2 parents 55ecb82 + 87d091c commit fdb3edd
Show file tree
Hide file tree
Showing 18 changed files with 798 additions and 0 deletions.
121 changes: 121 additions & 0 deletions sale_stock_warehouse_multicompany/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
=================================
sale stock warehouse multicompany
=================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8afec057f60529d15735ab62ab11ca70230885d40c35f8279df36b888066b8a0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/16.0/sale_stock_warehouse_multicompany
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-sale_stock_warehouse_multicompany
: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/multi-company&target_branch=16.0
:alt: Try me on Runboat

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

Allow multiple companies to sell the stock of a shared warehouse.

The sales order will belong to the company making the sale. As such, the taxes and related invoices will also belong to that selling company. The generated stock moves will belong to the company owning the stock and defined on the warehouse.

This approach also allows to use any route (like cross-docking or drop-shipment) on the sales order line.

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

Installation
============

Any sale & stock user must be part of any company defined on the warehouse.

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

On the warehouse, list the companies that are allowed to sell the stock.

Note that in standard you have a default value defining the default warehouse used on a sales order.
You can set inactive the warehouse automatically generated for each selling company and modify this default value to set the warehouse providing the goods.

Known issues / Roadmap
======================

* Test with a normal user that with the solution you can make a sale in DIVO and deliver goods from AB.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/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/multi-company/issues/new?body=module:%20sale_stock_warehouse_multicompany%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
~~~~~~~~~~~~

* Odoo S.A. (original module `inter_company_rules`)
* Andrea Stirpe <[email protected]>
* Adria Gil Sorribes <[email protected]>
* Christopher Ormaza <[email protected]>
* `Akretion <https://www.akretion.com>`:

* Chafique Delli <[email protected]>
* Alexis de Lattre <[email protected]>
* David Beal <[email protected]>
* `Tecnativa <https://www.tecnativa.com>`:

* Jairo Llopis
* David Vidal
* Pedro M. Baeza
* `Camptocamp <https://www.camptocamp.com>`:

* Maksym Yankin <[email protected]>
* Cyril Manuel Jeanneret <[email protected]>

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/multi-company <https://github.com/OCA/multi-company/tree/16.0/sale_stock_warehouse_multicompany>`_ 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_warehouse_multicompany/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions sale_stock_warehouse_multicompany/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "sale stock warehouse multicompany",
"summary": "Allow multiple companies to sell the stock of a shared warehouse",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/multi-company",
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["delivery"],
"data": [
"views/stock_warehouse_views.xml",
"views/stock_route_views.xml",
],
}
4 changes: 4 additions & 0 deletions sale_stock_warehouse_multicompany/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import stock_warehouse
from . import sale_order
from . import sale_order_line
from . import stock_route
14 changes: 14 additions & 0 deletions sale_stock_warehouse_multicompany/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

warehouse_id = fields.Many2one(
"stock.warehouse",
domain="[('company_ids', 'in', company_id)]",
check_company=False,
)
21 changes: 21 additions & 0 deletions sale_stock_warehouse_multicompany/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

route_id = fields.Many2one(
"stock.route",
domain="[('company_ids', 'in', company_id),('sale_selectable','=', True)]",
check_company=False,
)

def _prepare_procurement_values(self, group_id=False):
values = super()._prepare_procurement_values(group_id=group_id)
# Procurements must be created in warehouse company
if self.order_id.warehouse_id:
values["company_id"] = self.order_id.warehouse_id.company_id
return values
20 changes: 20 additions & 0 deletions sale_stock_warehouse_multicompany/models/stock_route.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).

from odoo import fields, models


class StockRoute(models.Model):
_inherit = "stock.route"

company_ids = fields.Many2many(
"res.company",
string="Companies",
compute="_compute_company_ids",
store=True,
readonly=False,
)

def _compute_company_ids(self):
for route in self:
route.company_ids = [(6, 0, route.company_id.ids)]
20 changes: 20 additions & 0 deletions sale_stock_warehouse_multicompany/models/stock_warehouse.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).

from odoo import fields, models


class Warehouse(models.Model):
_inherit = "stock.warehouse"

company_ids = fields.Many2many(
"res.company",
string="Companies",
compute="_compute_company_ids",
store=True,
readonly=False,
)

def _compute_company_ids(self):
for warehouse in self:
warehouse.company_ids = [(6, 0, warehouse.company_id.ids)]
1 change: 1 addition & 0 deletions sale_stock_warehouse_multicompany/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On the warehouse select the companies that are allowed to sell the stock.
3 changes: 3 additions & 0 deletions sale_stock_warehouse_multicompany/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Telmo Santos <[email protected]>
* Jacques-Etienne Baudoux (BCIM) <[email protected]>
* Cyril Manuel Jeanneret <[email protected]>
5 changes: 5 additions & 0 deletions sale_stock_warehouse_multicompany/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Allow multiple companies to sell the stock of a shared warehouse.

The sales order will belong to the company making the sale. As such, the taxes and related invoices will also belong to that selling company. The generated stock moves will belong to the company owning the stock and defined on the warehouse.

This approach also allows to use any route (like cross-docking or drop-shipment) on the sales order line.
Loading

0 comments on commit fdb3edd

Please sign in to comment.