Skip to content

Commit a864ee2

Browse files
committed
[IMP] operating_unit: Different user default per company
1 parent 1ce35e9 commit a864ee2

File tree

7 files changed

+55
-23
lines changed

7 files changed

+55
-23
lines changed

operating_unit/README.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
==============
62
Operating Unit
73
==============
@@ -17,7 +13,7 @@ Operating Unit
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
2218
:alt: License: LGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
@@ -92,6 +88,9 @@ Contributors
9288
* Jarsa Sistemas <[email protected]>
9389
* Andrea Stirpe <[email protected]>
9490
* Ooops, Ashish Hirpara <[email protected]>
91+
* `PyTech <https://www.pytech.it>`_:
92+
93+
* Simone Rubino <[email protected]>
9594

9695
Maintainers
9796
~~~~~~~~~~~

operating_unit/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Operating Unit",
77
"summary": "An operating unit (OU) is an organizational entity part of a "
88
"company",
9-
"version": "14.0.1.2.1",
9+
"version": "14.0.1.3.0",
1010
"author": "ForgeFlow, "
1111
"Serpent Consulting Services Pvt. Ltd.,"
1212
"Odoo Community Association (OCA)",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 Simone Rubino - PyTech
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
openupgrade.convert_to_company_dependent(
10+
env,
11+
"res.users",
12+
openupgrade.get_legacy_name("default_operating_unit_id"),
13+
"default_operating_unit_id",
14+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Simone Rubino - PyTech
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
# Save the value that will be restored as company-dependent
10+
openupgrade.rename_columns(
11+
env.cr,
12+
{
13+
"res_users": [
14+
("default_operating_unit_id", None),
15+
],
16+
},
17+
)

operating_unit/models/res_users.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _default_operating_units(self):
6060
string="Default Operating Unit",
6161
default=lambda self: self._default_operating_unit(),
6262
domain="[('company_id', '=', current_company_id)]",
63+
company_dependent=True,
6364
)
6465
operating_unit_readonly = fields.Boolean(compute="_compute_operating_unit_readonly")
6566

operating_unit/readme/CONTRIBUTORS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
* Jarsa Sistemas <[email protected]>
55
* Andrea Stirpe <[email protected]>
66
* Ooops, Ashish Hirpara <[email protected]>
7+
* `PyTech <https://www.pytech.it>`_:
8+
9+
* Simone Rubino <[email protected]>

operating_unit/static/description/index.html

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Operating Unit</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="operating-unit">
364+
<h1 class="title">Operating Unit</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="operating-unit">
370-
<h1>Operating Unit</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:41a8d6ec67ffa60083d069aa962e0015fa73373f55b1b3132d671c72ea2ab7ad
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/14.0/operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-operating_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/14.0/operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-operating_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>An operating unit (OU) is an organizational entity part of a company, with
379374
separate management ownership. Management by OU is aimed to introduce the
380375
following features:</p>
@@ -400,47 +395,51 @@ <h1>Operating Unit</h1>
400395
</ul>
401396
</div>
402397
<div class="section" id="configuration">
403-
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
398+
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
404399
<p>To configure this module, you need to:</p>
405400
<ul class="simple">
406401
<li>Assign <em>Multi Operating Unit</em> group to user.</li>
407402
<li>Go to <em>Settings / Users &amp; Companies / Operating Units</em> and create Operating Units.</li>
408403
</ul>
409404
</div>
410405
<div class="section" id="usage">
411-
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
406+
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
412407
<p>This module defines the operating unit entity and the user’s security rules.
413408
Other modules extend the standard Odoo apps with the OU.</p>
414409
</div>
415410
<div class="section" id="bug-tracker">
416-
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
411+
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
417412
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/operating-unit/issues">GitHub Issues</a>.
418413
In case of trouble, please check there if your issue has already been reported.
419414
If you spotted it first, help us to smash it by providing a detailed and welcomed
420415
<a class="reference external" href="https://github.com/OCA/operating-unit/issues/new?body=module:%20operating_unit%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
421416
<p>Do not contact contributors directly about support or help with technical issues.</p>
422417
</div>
423418
<div class="section" id="credits">
424-
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
419+
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
425420
<div class="section" id="authors">
426-
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
421+
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
427422
<ul class="simple">
428423
<li>ForgeFlow</li>
429424
<li>Serpent Consulting Services Pvt. Ltd.</li>
430425
</ul>
431426
</div>
432427
<div class="section" id="contributors">
433-
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
428+
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
434429
<ul class="simple">
435430
<li>ForgeFlow &lt;<a class="reference external" href="mailto:contact&#64;forgeflow.com">contact&#64;forgeflow.com</a>&gt;</li>
436431
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
437432
<li>Jarsa Sistemas &lt;<a class="reference external" href="mailto:info&#64;jarsa.com.mx">info&#64;jarsa.com.mx</a>&gt;</li>
438433
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
439434
<li>Ooops, Ashish Hirpara &lt;<a class="reference external" href="mailto:ashish.hirapara1995&#64;gmail.com">ashish.hirapara1995&#64;gmail.com</a>&gt;</li>
435+
<li><a class="reference external" href="https://www.pytech.it">PyTech</a>:<ul>
436+
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;pytech.it">simone.rubino&#64;pytech.it</a>&gt;</li>
437+
</ul>
438+
</li>
440439
</ul>
441440
</div>
442441
<div class="section" id="maintainers">
443-
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
442+
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
444443
<p>This module is maintained by the OCA.</p>
445444
<a class="reference external image-reference" href="https://odoo-community.org">
446445
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -453,6 +452,5 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
453452
</div>
454453
</div>
455454
</div>
456-
</div>
457455
</body>
458456
</html>

0 commit comments

Comments
 (0)