Skip to content

Commit a33f22f

Browse files
committed
Merge PR #445 into 19.0
Signed-off-by pedrobaeza
2 parents 576ba5b + 216db4d commit a33f22f

26 files changed

Lines changed: 1325 additions & 0 deletions

base_user_role_company/README.rst

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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+
5+
=====================
6+
User roles by company
7+
=====================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:22170e229c468ec41046141f10de50f397080458a7de6004f4a453721c02ca2f
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
24+
:target: https://github.com/OCA/server-backend/tree/19.0/base_user_role_company
25+
:alt: OCA/server-backend
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/server-backend-19-0/server-backend-19-0-base_user_role_company
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Enable User Roles depending on the Companies selected.
36+
37+
A company specific Role will only be enabled if it is set for **all**
38+
the currently selected companies.
39+
40+
For example, if a user is "Sales Manager" only for Company A, it will
41+
see that role enabled only if Company A is selected. If the user selects
42+
Company A and Company B, then the "Sales Manager" role won't be enabled.
43+
44+
**Table of contents**
45+
46+
.. contents::
47+
:local:
48+
49+
Configuration
50+
=============
51+
52+
Roles are set on the User form.
53+
54+
The "Company" additional column allows to set a Role as only valid for
55+
specific companies.
56+
57+
There is also a "Active Role" techincal field, only visible in developer
58+
mode. It shows what roles are active, after applying the company
59+
selection rules.
60+
61+
Usage
62+
=====
63+
64+
Select the active companies from the web client widget, near the top
65+
right corner. When doing so, the User's security Groups are recomputed,
66+
based on the Roles.
67+
68+
When the user changes the company selection, only the groups available
69+
to all active companies will be activated.
70+
71+
For example:
72+
73+
- A "SALES PERSON" and a "SALES MANAGER" roles are created.
74+
75+
- A user is assigned to the roles:
76+
77+
- "SALES PERSON", with no specific company assigned (meaning all)
78+
- "SALES MANAGER" only to "My Company (Chicago)"
79+
80+
- When selecting active companies from the UI widget:
81+
82+
- If only "My Company (San Francisco)" is active, "SALES PERSON"
83+
will be active.
84+
- If only "My Company (Chicago)" is active, "SALES PERSON" and
85+
"SALES MANAGER" will be active.
86+
- If both "My Company (San Francisco)" and "My Company (Chicago)" is
87+
active, "SALES PERSON" will be active.
88+
89+
Bug Tracker
90+
===========
91+
92+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
93+
In case of trouble, please check there if your issue has already been reported.
94+
If you spotted it first, help us to smash it by providing a detailed and welcomed
95+
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_role_company%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
96+
97+
Do not contact contributors directly about support or help with technical issues.
98+
99+
Credits
100+
=======
101+
102+
Authors
103+
-------
104+
105+
* Open Source Integrators
106+
107+
Contributors
108+
------------
109+
110+
`Open Source Integrators <http://opensourceintegrators.com>`__
111+
112+
- Daniel Reis <dreis@opensourceintegrators.com>
113+
- Chandresh Thakkar <cthakkr@opensourceintegrators.com>
114+
- Urvisha Desai <udesai@opensourceintegrators.com>
115+
116+
`WeSolved <http://wesolved.com>`__
117+
118+
- Robin Conjour <rconjour@wesolved.com>
119+
120+
`Dynapps <http://dynapps.eu>`__
121+
122+
- Bert Van Groenendael <bert.vangroenendael@dynapps.eu>
123+
124+
Maintainers
125+
-----------
126+
127+
This module is maintained by the OCA.
128+
129+
.. image:: https://odoo-community.org/logo.png
130+
:alt: Odoo Community Association
131+
:target: https://odoo-community.org
132+
133+
OCA, or the Odoo Community Association, is a nonprofit organization whose
134+
mission is to support the collaborative development of Odoo features and
135+
promote its widespread use.
136+
137+
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/19.0/base_user_role_company>`_ project on GitHub.
138+
139+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

base_user_role_company/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import controllers
5+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "User roles by company",
6+
"version": "19.0.1.0.0",
7+
"category": "Tools",
8+
"author": "Open Source Integrators, Odoo Community Association (OCA)",
9+
"license": "AGPL-3",
10+
"website": "https://github.com/OCA/server-backend",
11+
"depends": ["base_user_role"],
12+
"data": [
13+
"views/role.xml",
14+
"views/user.xml",
15+
],
16+
"installable": True,
17+
"maintainer": "dreispt",
18+
"development_status": "Beta",
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import main
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (C) 2022 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import http
5+
6+
from odoo.addons.web.controllers.home import Home
7+
8+
9+
class HomeExtended(Home):
10+
@http.route()
11+
def web_load_menus(self, *args, **kwargs):
12+
response = super().web_load_menus(*args, **kwargs)
13+
# On logout & re-login we could see wrong menus being rendered
14+
# To avoid this, menu http cache must be disabled
15+
# Using .pop() as Werkzeug Headers no longer supports __delitem__ (del)
16+
response.headers.pop("Cache-Control", None)
17+
return response
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * base_user_role_company
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 18.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: base_user_role_company
17+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__allowed_company_ids
18+
msgid "Companies"
19+
msgstr ""
20+
21+
#. module: base_user_role_company
22+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__company_id
23+
msgid "Company"
24+
msgstr ""
25+
26+
#. module: base_user_role_company
27+
#: model:ir.model,name:base_user_role_company.model_ir_http
28+
msgid "HTTP Routing"
29+
msgstr ""
30+
31+
#. module: base_user_role_company
32+
#: model:ir.model.fields,help:base_user_role_company.field_res_users_role_line__company_id
33+
msgid ""
34+
"If set, this role only applies when this is the main company selected. "
35+
"Otherwise it applies to all companies."
36+
msgstr ""
37+
38+
#. module: base_user_role_company
39+
#: model:ir.model.constraint,message:base_user_role_company.constraint_res_users_role_line_user_role_uniq
40+
msgid "Roles can be assigned to a user only once at a time"
41+
msgstr ""
42+
43+
#. module: base_user_role_company
44+
#: model:ir.model,name:base_user_role_company.model_res_users
45+
msgid "User"
46+
msgstr ""
47+
48+
#. module: base_user_role_company
49+
#. odoo-python
50+
#: code:addons/base_user_role_company/models/role.py:0
51+
msgid "User \"%(user)s\" does not have access to the company \"%(company)s\""
52+
msgstr ""
53+
54+
#. module: base_user_role_company
55+
#: model:ir.model,name:base_user_role_company.model_res_users_role_line
56+
msgid "Users associated to a role"
57+
msgstr ""

base_user_role_company/i18n/es.po

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * base_user_role_company
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2023-11-08 14:36+0000\n"
10+
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
11+
"Language-Team: none\n"
12+
"Language: es\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: base_user_role_company
20+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__allowed_company_ids
21+
msgid "Companies"
22+
msgstr "Compañías"
23+
24+
#. module: base_user_role_company
25+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__company_id
26+
msgid "Company"
27+
msgstr "Compañía"
28+
29+
#. module: base_user_role_company
30+
#: model:ir.model,name:base_user_role_company.model_ir_http
31+
msgid "HTTP Routing"
32+
msgstr "Enrutamiento HTTP"
33+
34+
#. module: base_user_role_company
35+
#: model:ir.model.fields,help:base_user_role_company.field_res_users_role_line__company_id
36+
msgid ""
37+
"If set, this role only applies when this is the main company selected. "
38+
"Otherwise it applies to all companies."
39+
msgstr ""
40+
"Si se establece, este rol sólo se aplica cuando ésta es la compañía "
41+
"principal seleccionada. De lo contrario, se aplica a todas las compañías."
42+
43+
#. module: base_user_role_company
44+
#: model:ir.model.constraint,message:base_user_role_company.constraint_res_users_role_line_user_role_uniq
45+
msgid "Roles can be assigned to a user only once at a time"
46+
msgstr "Las funciones sólo pueden asignarse a un usuario una vez cada vez"
47+
48+
#. module: base_user_role_company
49+
#: model:ir.model,name:base_user_role_company.model_res_users
50+
msgid "User"
51+
msgstr "Usuario"
52+
53+
#. module: base_user_role_company
54+
#. odoo-python
55+
#: code:addons/base_user_role_company/models/role.py:0
56+
msgid "User \"%(user)s\" does not have access to the company \"%(company)s\""
57+
msgstr "El usuario \"%(user)s\" no tiene acceso a la empresa \"%(company)s\""
58+
59+
#. module: base_user_role_company
60+
#: model:ir.model,name:base_user_role_company.model_res_users_role_line
61+
msgid "Users associated to a role"
62+
msgstr "Usuarios asociados a un papel"
63+
64+
#, python-format
65+
#~ msgid "User \"{}\" does not have access to the company \"{}\""
66+
#~ msgstr "Usuario \"{}\" no tiene acceso a la compañía \"{}\""

base_user_role_company/i18n/it.po

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * base_user_role_company
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2024-01-03 14:33+0000\n"
10+
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: base_user_role_company
20+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__allowed_company_ids
21+
msgid "Companies"
22+
msgstr "Aziende"
23+
24+
#. module: base_user_role_company
25+
#: model:ir.model.fields,field_description:base_user_role_company.field_res_users_role_line__company_id
26+
msgid "Company"
27+
msgstr "Azienda"
28+
29+
#. module: base_user_role_company
30+
#: model:ir.model,name:base_user_role_company.model_ir_http
31+
msgid "HTTP Routing"
32+
msgstr "Instradamento HTTP"
33+
34+
#. module: base_user_role_company
35+
#: model:ir.model.fields,help:base_user_role_company.field_res_users_role_line__company_id
36+
msgid ""
37+
"If set, this role only applies when this is the main company selected. "
38+
"Otherwise it applies to all companies."
39+
msgstr ""
40+
"Se impostato, questo ruolo si applica solo quando questa è l'azienda "
41+
"principale selezionata. Altrimenti vale per tutte le aziende."
42+
43+
#. module: base_user_role_company
44+
#: model:ir.model.constraint,message:base_user_role_company.constraint_res_users_role_line_user_role_uniq
45+
msgid "Roles can be assigned to a user only once at a time"
46+
msgstr "I ruoli possono essere assegnati all'utente solo uno alla volta"
47+
48+
#. module: base_user_role_company
49+
#: model:ir.model,name:base_user_role_company.model_res_users
50+
msgid "User"
51+
msgstr "Utente"
52+
53+
#. module: base_user_role_company
54+
#. odoo-python
55+
#: code:addons/base_user_role_company/models/role.py:0
56+
msgid "User \"%(user)s\" does not have access to the company \"%(company)s\""
57+
msgstr "L'utente \"%(user)s\" non ha accesso all'azienda \"%(company)s\""
58+
59+
#. module: base_user_role_company
60+
#: model:ir.model,name:base_user_role_company.model_res_users_role_line
61+
msgid "Users associated to a role"
62+
msgstr "Utenti associati al ruolo"
63+
64+
#, python-format
65+
#~ msgid "User \"{}\" does not have access to the company \"{}\""
66+
#~ msgstr "L'utente \"{}\" non ha l'accesso all'azienda \"{}\""
67+
68+
#~ msgid "Display Name"
69+
#~ msgstr "Nome visualizzato"
70+
71+
#~ msgid "ID"
72+
#~ msgstr "ID"
73+
74+
#~ msgid "Last Modified on"
75+
#~ msgstr "Ultima modifica il"
76+
77+
#~ msgid "Users"
78+
#~ msgstr "Utenti"
79+
80+
#~ msgid "Active Role"
81+
#~ msgstr "Ruolo attivo"

0 commit comments

Comments
 (0)