Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] sales_team_security #3087

Merged
merged 31 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f3b61ba
[ADD] sales_team_security
pedrobaeza Mar 5, 2016
8ab3ca3
[MIG] sales_team_security: Adaptation to v11 + enhancement
pedrobaeza Nov 5, 2018
de1d363
[FIX] sales_team_security: Allow to see all the public partners to sa…
pedrobaeza Nov 20, 2018
27961ab
[MIG] sales_team_security: Migration to 12.0
May 29, 2019
05feb61
[IMP] sales_team_security: Contacts permissions revamp
pedrobaeza Jun 22, 2020
d90fce4
[IMP] : black, isort, prettier
pedrobaeza Sep 24, 2020
2b5f178
[IMP] sales_team_security: Adjust team according salesman in partners
pedrobaeza Mar 15, 2021
38da414
[MIG] sales_team_security: Migration to 13.0
pedrobaeza Sep 24, 2020
43e79bb
[UPD] Update sales_team_security.pot
oca-travis Sep 28, 2020
64a16d7
[FIX] sales_team_security: Remove team_id field in partner_view becau…
victoralmau Apr 16, 2021
745b48c
[MIG] sales_team_security: Migration to 14.0
ivantodorovich Nov 25, 2020
439d54a
[IMP] : black, isort, prettier, pre-commit
ivantodorovich Nov 25, 2020
bfe85fb
[IMP] Split module: remove sale and crm dependancy
ivantodorovich Nov 25, 2020
e192236
[IMP] Implement uninstall hook to revert changes in res.groups
ivantodorovich Nov 25, 2020
00b7f94
[UPD] Update sales_team_security.pot
oca-travis Jul 3, 2021
4578e8d
[IMP] sales_team_security: Auto-followers on main & invoice/shipping …
victoralmau Feb 3, 2021
94f7b24
[FIX] sales_team_security: Adjust security rules for team managers
pedrobaeza Jun 8, 2021
cfbb0a1
[IMP] sales_team_security: Auto-followers - Adapt to 14.0
victoralmau Nov 29, 2021
2b08e3f
[MIG] sales_team_security: Migration to 15.0
cesar-tecnativa Jun 2, 2022
eb2878d
[FIX] Update deprecated unit tests
Oct 11, 2022
d6cf689
[FIX] sales_team_security: Sync followers on partner creation
pedrobaeza Oct 18, 2022
1bc6616
Translated using Weblate (Italian)
francesco-ooops Mar 20, 2023
6b96a6d
[MIG] sales_team_security: Migration to 16.0
Mar 31, 2023
a7f8f50
[UPD] Update sales_team_security.pot
Aug 8, 2023
3c9cbda
[UPD] README.rst
OCA-git-bot Aug 8, 2023
c10387c
Update translation files
weblate Aug 8, 2023
6e40b4d
[UPD] README.rst
OCA-git-bot Sep 3, 2023
ee58740
Translated using Weblate (Italian)
mymage Dec 1, 2023
03e29da
Translated using Weblate (Italian)
mymage Dec 12, 2023
b3ec677
[IMP] sales_team_security: pre-commit auto fixes
Deriman-Alonso Apr 19, 2024
9e049c8
[MIG] sales_team_security: Migration to 17.0
Deriman-Alonso Apr 19, 2024
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
150 changes: 150 additions & 0 deletions sales_team_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
===============================================
Sales documents permissions by channels (teams)
===============================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/17.0/sales_team_security
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sales_team_security
: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/sale-workflow&target_branch=17.0
:alt: Try me on Runboat

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

This module adds a new "Sale" group called "User: Team documents", that
includes the proper permissions for showing only the information related
to that user sale team (having assigned that team/channel or no team at
all, independently from the assigned salesman):

- Contacts.
- Quotations/Sales Orders (implemented in sales_team_security_sale)
- Leads/Opportunities (implemented in sales_team_security_crm)

It also handles the propagation of the sales team from commercial
partners to the contacts, which standard doesn't do.

It also handles the sync (auto-creation and remove) of followers in
company partners and childs of them according to salesmans. Any example
about it: - Partner company > Salesman: Admin - Partner company, Contact
1 > Without salesman - Partner company, Contact 2 > Salesman: Demo All
these partners have these followers: Admin + Demo

And finally, there are rules for partners to be restricted to the own
ones for the group "User: Own Documents Only" for being coherent with
the permission scheme. Someone with this permission will see:

- Contacts without salesman nor team assigned.
- Contacts without salesman assigned, but the same team.
- Contacts with them as salesman, independently from the team.
- Contacts with them as follower.

For keeping consistent accesses, followers of the main and
shipping/invoice contacts are synced according the salesman of the
children contacts

**Table of contents**

.. contents::
:local:

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

At installation time, this module sets in all the contacts that have the
sales team empty the sales team of the parent, and sync followers in
parent contacts and invoice/shipping addresses. If you have a lot of
contacts, this operation can take a while.

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

1. Go to *Configuration > Users & Companies > Users*.
2. Open or create a user.
3. On the section "Sale", select "User: Team documents".

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

- This module modifies sales security groups hierarchy, so any other
module doing something similar might conflict with this one.

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

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

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza
- Víctor Martínez
- César A. Sánchez

- `Guadaltech <https://www.guadaltech.es>`__:

- Ramón Bajona

- Iván Todorovich <[email protected]>
- `Pesol <https://www.pesol.es>`__:

- Jonathan Oscategui Taza <[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.

.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px
:target: https://github.com/pedrobaeza
:alt: pedrobaeza
.. |maintainer-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px
:target: https://github.com/ivantodorovich
:alt: ivantodorovich

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pedrobaeza| |maintainer-ivantodorovich|

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sales_team_security>`_ 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 sales_team_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from .hooks import post_init_hook, uninstall_hook
19 changes: 19 additions & 0 deletions sales_team_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2016-2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Sales documents permissions by channels (teams)",
"summary": "New group for seeing only sales channel's documents",
"version": "17.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"development_status": "Production/Stable",
"maintainers": ["pedrobaeza", "ivantodorovich"],
"depends": ["sales_team"],
"data": ["security/sales_team_security.xml", "views/res_partner_view.xml"],
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
}
43 changes: 43 additions & 0 deletions sales_team_security/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2018-2016 Tecnativa - Pedro M. Baeza
# Copyright 2020 - Iván Todorovich
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api


def post_init_hook(env):
"""At installation time, propagate the parent sales team to the children
contacts that have this field empty, as it's supposed that the intention
is to have the same.
"""
env.cr.execute(
"""UPDATE res_partner
SET team_id=parent.team_id
FROM res_partner AS parent
WHERE parent.team_id IS NOT NULL
AND res_partner.parent_id = parent.id
AND res_partner.team_id IS NULL"""
)


def uninstall_hook(env): # pragma: no cover
"""At uninstall, revert changes made to record rules"""
with api.Environment.manage():
env.ref("sales_team.group_sale_salesman_all_leads").write(
{
"implied_ids": [
(6, 0, [env.ref("sales_team.group_sale_salesman").id]),
],
}
)
# At installation time, we need to sync followers
partners = env["res.partner"].search(
[
("parent_id", "=", False),
("is_company", "=", True),
"|",
("user_id", "!=", False),
("child_ids.user_id", "!=", False),
]
)
partners._add_followers_from_salesmans()
69 changes: 69 additions & 0 deletions sales_team_security/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sales_team_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-28 21:00+0000\n"
"PO-Revision-Date: 2022-06-28 21:00+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sales_team_security
#: model:ir.model,name:sales_team_security.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: sales_team_security
#: model:ir.model.fields,help:sales_team_security.field_res_partner__team_id
#: model:ir.model.fields,help:sales_team_security.field_res_users__team_id
msgid ""
"If set, this Sales Team will be used for sales and assignments related to "
"this partner"
msgstr ""
"Si está configurado, este equipo de ventas será usado para las ventas y "
"asignaciones relacionadas a este partner."

#. module: sales_team_security
#: model:ir.model,name:sales_team_security.model_ir_rule
msgid "Record Rule"
msgstr "Regla de registro"

#. module: sales_team_security
#: model:ir.model.fields,field_description:sales_team_security.field_res_partner__team_id
#: model:ir.model.fields,field_description:sales_team_security.field_res_users__team_id
msgid "Sales Team"
msgstr "Equipo de ventas"

#. module: sales_team_security
#: model:ir.model.fields,field_description:sales_team_security.field_res_partner__user_id
#: model:ir.model.fields,field_description:sales_team_security.field_res_users__user_id
msgid "Salesperson"
msgstr "Comercial"

#. module: sales_team_security
#: model:ir.model.fields,help:sales_team_security.field_res_partner__user_id
#: model:ir.model.fields,help:sales_team_security.field_res_users__user_id
msgid "The internal user in charge of this contact."
msgstr "El usuario interno a cargo de este contacto."

#. module: sales_team_security
#: model:res.groups,comment:sales_team_security.group_sale_team_manager
msgid ""
"The user will have an access to the documents of the sales teams he/she "
"belongs to."
msgstr ""
"El usuario tendrá acceso a los documentos de los equipos comerciales a los "
"que pertenece."

#. module: sales_team_security
#: model:res.groups,name:sales_team_security.group_sale_team_manager
msgid "User: Team Documents Only"
msgstr "Usuario: Solo documentos del equipo"
69 changes: 69 additions & 0 deletions sales_team_security/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sales_team_security
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-28 21:01+0000\n"
"PO-Revision-Date: 2023-12-12 11:01+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: \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: sales_team_security
#: model:ir.model,name:sales_team_security.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: sales_team_security
#: model:ir.model.fields,help:sales_team_security.field_res_partner__team_id
#: model:ir.model.fields,help:sales_team_security.field_res_users__team_id
msgid ""
"If set, this Sales Team will be used for sales and assignments related to "
"this partner"
msgstr ""
"Se impostato, il team di vendita viene utilizzato per vendite e assegnazioni "
"correlate al partner"

#. module: sales_team_security
#: model:ir.model,name:sales_team_security.model_ir_rule
msgid "Record Rule"
msgstr "Regola su record"

#. module: sales_team_security
#: model:ir.model.fields,field_description:sales_team_security.field_res_partner__team_id
#: model:ir.model.fields,field_description:sales_team_security.field_res_users__team_id
msgid "Sales Team"
msgstr "Team di vendita"

#. module: sales_team_security
#: model:ir.model.fields,field_description:sales_team_security.field_res_partner__user_id
#: model:ir.model.fields,field_description:sales_team_security.field_res_users__user_id
msgid "Salesperson"
msgstr "Addetto vendite"

#. module: sales_team_security
#: model:ir.model.fields,help:sales_team_security.field_res_partner__user_id
#: model:ir.model.fields,help:sales_team_security.field_res_users__user_id
msgid "The internal user in charge of this contact."
msgstr "L'utente interno responsabile di questo contatto."

#. module: sales_team_security
#: model:res.groups,comment:sales_team_security.group_sale_team_manager
msgid ""
"The user will have an access to the documents of the sales teams he/she "
"belongs to."
msgstr ""
"L'utente avrà accesso ai documenti del team di vendita a cui appartiene."

#. module: sales_team_security
#: model:res.groups,name:sales_team_security.group_sale_team_manager
msgid "User: Team Documents Only"
msgstr "Utente: solo documenti del team"
Loading
Loading