Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c07ac36
Migrated sale_operating_unit module and its test cases.
sudhir-serpentcs Feb 9, 2016
49c22bf
Added OU and WH constraints in SO.
sudhir-serpentcs Feb 10, 2016
c447935
migrate code to v9 (wip)
AaronHForgeFlow Aug 23, 2016
1f76991
[MIG] sale_operating_unit: Migrated to 10.0
AaronHForgeFlow Jan 31, 2017
612cf62
[FIX] readonly on OU
serpentcs-dev1 Jul 4, 2017
097437f
[MIG] sale_operating_unit: Migration to v11
bjeficent Jan 31, 2019
0334d50
[ADD] icon.png
OCA-git-bot May 21, 2019
ac6820d
[UPD] README.rst
OCA-git-bot Jul 29, 2019
975be2c
[MIG]sale_operating_unit to v12
bjeficent Nov 26, 2019
1be73f4
[IMP]sale advance payment to include the OU
AaronHForgeFlow Nov 26, 2019
e532f50
[UPD] Update sale_operating_unit.pot
oca-travis Nov 26, 2019
6728abd
[UPD] README.rst
OCA-git-bot Nov 26, 2019
9b56c4e
[FIX] Delete uncalled file
MiquelRForgeFlow Nov 29, 2019
58e7d9e
[UPD] Update sale_operating_unit.pot
oca-travis Nov 29, 2019
cd17444
sale_operating_unit 12.0.1.0.1
OCA-git-bot Nov 29, 2019
2091962
[IMP] sale_operating_unit: black, isort
alan196 Feb 12, 2020
53545e1
[MIG] sale_operating_unit: Migration to V13
alan196 Feb 12, 2020
631f03b
[UPD] Update sale_operating_unit.pot
oca-travis Apr 16, 2020
5652818
[UPD] Eficent -> ForgeFlow
MiquelRForgeFlow Oct 5, 2020
91007c7
[UPD] README.rst
OCA-git-bot Oct 5, 2020
07b06f6
[MIG] sale_operating_unit: Migration to 14.0
Mar 9, 2022
06c78b4
[UPD] README.rst
OCA-git-bot Oct 25, 2022
6c5dbec
[UPD] Update sale_operating_unit.pot
Jan 17, 2023
f6015a9
[FIX] Error sale report to add fiel operating unit
cramosh Jan 27, 2023
ca07280
[FIX] 14.0 sale_operating_unit Error sale report to add field operati…
cramosh Jan 27, 2023
0a45bd7
[UPD] README.rst
OCA-git-bot Jan 27, 2023
0548a22
sale_operating_unit 14.0.1.0.1
OCA-git-bot Jan 27, 2023
cb22570
[FIX] sale_operating_unit: make operating_unit_id field in sale.order…
alan196 Oct 6, 2022
a1c90b9
[15.0][MIG] sale_operating_unit: Migration to 15.0
Jun 20, 2022
871155f
[UPD] Update sale_operating_unit.pot
Jun 6, 2023
435ae81
[UPD] README.rst
OCA-git-bot Jun 6, 2023
03fd64b
[FIX] sale_operating_unit: permission update OU in invoices
Saran440 Jun 27, 2023
4a8ad0c
sale_operating_unit 15.0.1.0.1
OCA-git-bot Jun 28, 2023
82c2a8a
[UPD] README.rst
OCA-git-bot Sep 3, 2023
e8f1353
[IMP] sale_operating_unit: pre-commit execution
May 29, 2024
479fe07
[MIG] sale_operating_unit: Migration to 17.0
May 29, 2024
614ff80
[UPD] Update sale_operating_unit.pot
Aug 5, 2024
f438a3f
[BOT] post-merge updates
OCA-git-bot Aug 5, 2024
e3aca82
Added translation using Weblate (Italian)
mymage Aug 7, 2024
a26377d
Translated using Weblate (Italian)
mymage Aug 7, 2024
433cf97
[IMP] sale_operating_unit: pre-commit auto fixes
BhaveshHeliconia Mar 12, 2025
e76ed23
[MIG] sale_operating_unit: Migration to 18.0
BhaveshHeliconia Mar 12, 2025
9ac01bd
Merge PR #756 into 18.0
OCA-git-bot Dec 9, 2025
b0df47b
[UPD] Update sale_operating_unit.pot
Dec 9, 2025
1a230b7
[BOT] post-merge updates
OCA-git-bot Dec 9, 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ addon | version | maintainers | summary
[operating_unit_access_all](operating_unit_access_all/) | 18.0.1.0.0 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Access all Operating Units
[purchase_operating_unit](purchase_operating_unit/) | 18.0.1.0.0 | | Adds the concecpt of operating unit (OU) in purchase order management
[report_qweb_operating_unit](report_qweb_operating_unit/) | 18.0.1.0.0 | | Qweb Report With Operating Unit
[sale_operating_unit](sale_operating_unit/) | 18.0.1.0.0 | | An operating unit (OU) is an organizational entity part of a company
[sales_team_operating_unit](sales_team_operating_unit/) | 18.0.1.0.0 | | Sales Team Operating Unit
[stock_operating_unit](stock_operating_unit/) | 18.0.1.0.0 | | Adds the concept of operating unit (OU) in stock management
[stock_operating_unit_access_all](stock_operating_unit_access_all/) | 18.0.1.0.0 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Access all OUs' Stock
Expand Down
112 changes: 112 additions & 0 deletions sale_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=======================
Operating Unit in Sales
=======================

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

.. |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/license-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_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_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 extends the Sales capabilities of Odoo and introduces the
operating unit to the Sales Order. Security rules are defined to ensure
that users can only display the Sales Orders in which they are allowed
access to.

**Table of contents**

.. contents::
:local:

Usage
=====

Follow these steps:

1. Create a Sale Order.
2. The Operating Unit of the Sale Team is assigned to the Sale Order.

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

The onchange_team_id method is not working. If you try to change the
team in a sales quotation and the operating unit is not taken from the
sales team, and moreover, I cannot select the operating unit from the
team, only Main OU shows, must have to have your salesperson in the
sales team of the operating unit.

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_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
-------

* ForgeFlow
* Serpent Consulting Services Pvt. Ltd.

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

- Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
- Aaron Henriquez <ahforgeflow@forgeflow.com>
- Lois Rilo <lois.rilo@forgeflow.com>
- Miquel Raich <miquel.raich@forgeflow.com>
- Sudhir Arya <sudhir.arya@serpentcs.com>
- Darshan Patel <darshan.patel.serpencs@gmail.com>
- Alan Ramos <alan.ramos@jarsa.com.mx>
- Jorge Alberto Olvera Cuenca <jorge.olvera@jarsa.com>
- Alejandro Padrón <alejandro.padron@bt-group.com>
- `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_operating_unit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions sale_operating_unit/__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 models
from . import report
23 changes: 23 additions & 0 deletions sale_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# © 2019 ForgeFlow S.L.
# - Jordi Ballester Alomar
# © 2019 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",
"version": "18.0.1.0.0",
"summary": "An operating unit (OU) is an organizational entity part of a "
"company",
"author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/operating-unit",
"category": "Sales Management",
"depends": ["sale", "account_operating_unit", "sales_team_operating_unit"],
"data": [
"security/sale_security.xml",
"views/sale_view.xml",
"views/sale_report_view.xml",
],
"installable": True,
}
68 changes: 68 additions & 0 deletions sale_operating_unit/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-07 08:58+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 5.6.2\n"

#. module: sale_operating_unit
#. odoo-python
#: code:addons/sale_operating_unit/models/crm_team.py:0
#, python-format
msgid ""
"Configuration error. It is not possible to change this team. There are sale "
"orders referencing it in other operating units"
msgstr ""
"Errore di configurazione. Non è possibile modificare questo team. Esistono "
"ordini di vendita relazionati ad esso in altre unità operative"

#. module: sale_operating_unit
#. odoo-python
#: code:addons/sale_operating_unit/models/sale_order.py:0
#, python-format
msgid ""
"Configuration error. The Operating Unit of the sales team must match with "
"that of the quote/sales order."
msgstr ""
"Errore di configurazione. L'unità operativa del team di vendita deve essere "
"la stessa del preventivo/ordine di vendita."

#. module: sale_operating_unit
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_order__operating_unit_id
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_order_line__operating_unit_id
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_report__operating_unit_id
#: model_terms:ir.ui.view,arch_db:sale_operating_unit.view_sale_report_search
#: model_terms:ir.ui.view,arch_db:sale_operating_unit.view_sales_order_filter
msgid "Operating Unit"
msgstr "Unità operativa"

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_sale_report
msgid "Sales Analysis Report"
msgstr "Resoconto analisi vendite"

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

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr "Riga ordine di vendita"

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_crm_team
msgid "Sales Team"
msgstr "Team di vendita"
59 changes: 59 additions & 0 deletions sale_operating_unit/i18n/sale_operating_unit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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_operating_unit
#. odoo-python
#: code:addons/sale_operating_unit/models/crm_team.py:0
msgid ""
"Configuration error. It is not possible to change this team. There are sale "
"orders referencing it in other operating units"
msgstr ""

#. module: sale_operating_unit
#. odoo-python
#: code:addons/sale_operating_unit/models/sale_order.py:0
msgid ""
"Configuration error. The Operating Unit of the sales team must match with "
"that of the quote/sales order."
msgstr ""

#. module: sale_operating_unit
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_order__operating_unit_id
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_order_line__operating_unit_id
#: model:ir.model.fields,field_description:sale_operating_unit.field_sale_report__operating_unit_id
#: model_terms:ir.ui.view,arch_db:sale_operating_unit.view_sale_report_search
#: model_terms:ir.ui.view,arch_db:sale_operating_unit.view_sales_order_filter
msgid "Operating Unit"
msgstr ""

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_sale_report
msgid "Sales Analysis Report"
msgstr ""

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

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_operating_unit
#: model:ir.model,name:sale_operating_unit.model_crm_team
msgid "Sales Team"
msgstr ""
4 changes: 4 additions & 0 deletions sale_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 crm_team
from . import sale_order
34 changes: 34 additions & 0 deletions sale_operating_unit/models/crm_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# © 2019 ForgeFlow S.L.
# - Jordi Ballester Alomar
# © 2019 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import SUPERUSER_ID, api, models
from odoo.exceptions import ValidationError


class CrmTeam(models.Model):
_inherit = "crm.team"

@api.constrains("operating_unit_id")
def _check_sales_order_operating_unit(self):
for rec in self:
orders = (
self.with_user(SUPERUSER_ID)
.env["sale.order"]
.search(
[
("team_id", "=", rec.id),
("operating_unit_id", "!=", rec.operating_unit_id.id),
]
)
)
if orders:
raise ValidationError(
self.env._(
"Configuration error. It is not "
"possible to change this "
"team. There are sale orders "
"referencing it in other operating "
"units"
)
)
Loading