Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0f28363
Added Sale Stock OU module for v8.
sudhir-serpentcs Feb 10, 2016
b2ccd01
Migrated Sale Stock OU module from v7 to v8.
sudhir-serpentcs Feb 10, 2016
036d768
Added Test cases and Readme file.
sudhir-serpentcs Feb 10, 2016
7bb54d2
Migrate to v9
AaronHForgeFlow Aug 24, 2016
37cb6d1
[MIG] sale_stock_operating_unit to v10.
LoisRForgeFlow Jan 31, 2017
722e55f
Fix constraint on warehouses (#61)
Feb 8, 2017
d7827c8
[FIX]team operating unit has more priority than the default warehouse
AaronHForgeFlow May 16, 2018
e660b28
[MIG] sale_stock_operating_unit: Migration to v12
bjeficent Feb 11, 2019
3c161bf
[IMP] Sale Multi Ware
osi-scampbell Jan 15, 2020
d7e67f2
Added translation using Weblate (Portuguese)
pedrocs-exo Feb 29, 2020
06b15b9
Translated using Weblate (Portuguese)
pedrocs-exo Feb 29, 2020
3441d7f
Added translation using Weblate (Italian)
francesco-ooops Jan 8, 2021
0ab959a
Translated using Weblate (Italian)
francesco-ooops Jun 17, 2021
1876556
[IMP] sale_stock_operating_unit: black, isort, prettier
Jun 20, 2022
aa7b9f4
[15.0][MIG] sale_stock_operating_unit: Migration to 15.0
Jun 20, 2022
4013ef5
Translated using Weblate (Italian)
mymage Jun 12, 2023
ecf014f
Translated using Weblate (Italian)
mymage Sep 22, 2023
264f6a8
[IMP] sale_stock_operating_unit: pre-commit execution
May 29, 2024
7119a8d
[MIG] sale_stock_operating_unit: Migration to 17.0
May 29, 2024
c14ccf4
[MIG] sale_stock_operating_unit: Migration to 18.0
BhaveshHeliconia Mar 12, 2025
4cede04
[DON'T MERGE] test-requirements.txt
BhaveshHeliconia Mar 12, 2025
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
103 changes: 103 additions & 0 deletions sale_stock_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
=============================
Operating Unit in Sales Stock
=============================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
:target: https://github.com/OCA/operating-unit/tree/18.0/sale_stock_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/operating-unit-18-0/operating-unit-18-0-sale_stock_operating_unit
: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/operating-unit&target_branch=18.0
:alt: Try me on Runboat

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

This module was written to extend the Sales and the Stock capabilities
of Odoo. This module introduces some new operating unit (OU)
capabilities in order to enhance the performance of already existing OU
features for Sales and Stock.

**Table of contents**

.. contents::
:local:

Usage
=====

Follow these steps:

1. Use a created Operating Unit (OU) or create one in Settings ->
Users&Companies -> Operating Units.
2. Use a created Sales Team or create a new one in Sales ->
Configuration -> Sales Team and assign an OU
3. Create a new Warehouse with the previous OU (or use a Warehouse with
an assigned OU)
4. Check the Location has the same OU as the Warehouse in Inventory ->
Configuration Locations (make sure you have Storage Locations
checkbox activated)
5. Create a new Sale Order with the Sales Team, Operating Unit and
Warehouse used/created before.
6. OU, Picking Type and Location are propagated to the Picking.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/operating-unit/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/operating-unit/issues/new?body=module:%20sale_stock_operating_unit%0Aversion:%2018.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
-------

* Eficent
* Serpent Consulting Services Pvt. Ltd.

Contributors
------------

- Eficent Business and IT Consulting Services S.L. <[email protected]>
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
- Alejandro Padrón <[email protected]>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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/operating-unit <https://github.com/OCA/operating-unit/tree/18.0/sale_stock_operating_unit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sale_stock_operating_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
22 changes: 22 additions & 0 deletions sale_stock_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Operating Unit in Sales Stock",
"summary": "An operating unit (OU) is an organizational entity part of a "
"company",
"version": "18.0.1.0.0",
"author": "Eficent, Serpent Consulting Services Pvt. Ltd., "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/operating-unit",
"category": "Sales Management",
"depends": [
"sale_stock",
"sale_operating_unit",
"stock_operating_unit",
],
"installable": True,
}
56 changes: 56 additions & 0 deletions sale_stock_operating_unit/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-09-22 16:38+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/sale_order.py:0
#, python-format
msgid ""
"Configuration error!\n"
"The OperatingUnit in the Sales Order and in the Warehouse must be the same."
msgstr ""
"Errore di configurazione!\n"
"L'Unità Operativa nell'ordine di vendita e nel magazzino deve essere la "
"stessa."

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_sale_order
msgid "Sales Order"
msgstr "Ordine di vendita"

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/stock_warehouse.py:0
#, python-format
msgid ""
"Sales Order records already exist(s) for this warehouse and operating unit."
msgstr ""
"Esistono già degli ordini di vendita per questo magazzino e Unità Operativa."

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_warehouse
msgid "Warehouse"
msgstr "Magazzino"

#~ msgid "Sale Order"
#~ msgstr "Ordine di Vendita"
57 changes: 57 additions & 0 deletions sale_stock_operating_unit/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-02-29 15:13+0000\n"
"Last-Translator: Pedro Castro Silva <[email protected]>\n"
"Language-Team: none\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.10\n"

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/sale_order.py:0
#, python-format
msgid ""
"Configuration error!\n"
"The OperatingUnit in the Sales Order and in the Warehouse must be the same."
msgstr ""
"Erro de Configuração!\n"
"As Unidades Operacionais na Encomenda de Venda e no Armazém têm que ser "
"iguais."

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/stock_warehouse.py:0
#, python-format
msgid ""
"Sales Order records already exist(s) for this warehouse and operating unit."
msgstr ""
"Já existem registos de Encomendas de Vendas para este armazém e unidade "
"operacional."

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_move
msgid "Stock Move"
msgstr "Movimento de Stock"

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_warehouse
msgid "Warehouse"
msgstr "Armazém"

#~ msgid "Sale Order"
#~ msgstr "Encomenda de Venda"
46 changes: 46 additions & 0 deletions sale_stock_operating_unit/i18n/sale_stock_operating_unit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/sale_order.py:0
#, python-format
msgid ""
"Configuration error!\n"
"The OperatingUnit in the Sales Order and in the Warehouse must be the same."
msgstr ""

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_stock_operating_unit
#. odoo-python
#: code:addons/sale_stock_operating_unit/models/stock_warehouse.py:0
#, python-format
msgid ""
"Sales Order records already exist(s) for this warehouse and operating unit."
msgstr ""

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: sale_stock_operating_unit
#: model:ir.model,name:sale_stock_operating_unit.model_stock_warehouse
msgid "Warehouse"
msgstr ""
4 changes: 4 additions & 0 deletions sale_stock_operating_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import sale_order
from . import stock_move
from . import stock_warehouse
45 changes: 45 additions & 0 deletions sale_stock_operating_unit/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, models
from odoo.exceptions import ValidationError


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

@api.depends("user_id", "company_id", "operating_unit_id")
def _compute_warehouse_id(self):
res = super()._compute_warehouse_id()
for sale in self:
if sale.warehouse_id.operating_unit_id != sale.operating_unit_id:
warehouse = self.env["stock.warehouse"].search(
[
(
"operating_unit_id",
"=",
sale.operating_unit_id.id,
),
],
limit=1,
)
if warehouse:
sale.warehouse_id = warehouse.id
return res

@api.constrains("operating_unit_id", "warehouse_id")
def _check_wh_operating_unit(self):
for rec in self:
if (
rec.warehouse_id.operating_unit_id
and rec.operating_unit_id
and rec.operating_unit_id != rec.warehouse_id.operating_unit_id
):
raise ValidationError(
self.env._(
"Configuration error!\nThe Operating"
"Unit in the Sales Order and in the"
" Warehouse must be the same."
)
)
24 changes: 24 additions & 0 deletions sale_stock_operating_unit/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models


class StockMove(models.Model):
_inherit = "stock.move"

def _get_new_picking_values(self):
"""
Override to add Operating Units to Picking.
"""
values = super()._get_new_picking_values()

values.update(
{
"operating_unit_id": self.sale_line_id.operating_unit_id.id
or self.operating_unit_id.id
}
)

return values
28 changes: 28 additions & 0 deletions sale_stock_operating_unit/models/stock_warehouse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, models
from odoo.exceptions import ValidationError


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

@api.constrains("operating_unit_id")
def _check_existing_so_in_wh(self):
for rec in self:
sales = self.env["sale.order"].search(
[
("warehouse_id", "=", rec.id),
("operating_unit_id", "!=", rec.operating_unit_id.id),
],
limit=1,
)
if sales:
raise ValidationError(
self.env._(
"Sales Order records already exist(s) for this warehouse"
" and operating unit."
)
)
Loading
Loading