Skip to content

Conversation

@lef-adhoc
Copy link
Contributor

No description provided.

pedrobaeza and others added 30 commits October 21, 2025 17:29
==============================
Security rules for sales teams
==============================

This module sets different permissions levels for accessing sales and CRM
records based on the sales team: customers, sales orders, leads, opportunities,
phone calls and sales teams.

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

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

At installation time, this module sets int all the contacts that have the sales
team empty the sales team of the parent. If you have a lot of contacts, this
operation can take a while.

Usage
=====

On the user configuration (Configuration > Users > Users), select in the
*Sales Team* section the option "See only own team". Then, the documents
mentioned before will be filtered out to have only those belonging to the
teams the user belongs to.

This is complementary to the Sales level access, but sometimes can be
incoherent depending on the combination chosen. If you chose "See Own Leads"
on _Sales_ section, marking on unmarking the sales team check will be
irrelevant, because the most restricting level, which the sales one, will
prevail.

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

* This module is designed for supporting only sales part, so someone that has
  access to other Odoo parts (for example, an accountant), shouldn't have
  this new permission, or some access errors will be found when seeing invoices
  and other documents. A _sales_team_security_account_ bridge module can be
  done for fixing this case, but not in the case of for example warehouse.
Restrict contacts by code, removing the need of manually manipulating the existing
record rules, that can also have some side effects.
- Standard procedure
- Adapt partner view
- Adapt tests
Translated using Weblate (Spanish)

Currently translated at 100.0% (4 of 4 strings)

Translation: sale-workflow-13.0/sale-workflow-13.0-sales_team_security
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sales_team_security/es/

Added translation using Weblate (Italian)

Translated using Weblate (Italian)

Currently translated at 100.0% (4 of 4 strings)

Translation: sale-workflow-13.0/sale-workflow-13.0-sales_team_security
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sales_team_security/it/
…contacts + others

- For avoiding access errors on this records that are related to sales flow
- Sync salesman on parent change

Co-Authored-By: Pedro M. Baeza <[email protected]>
A team manager wasn't able to access to their orders if the team was
different from their team.

Whole review has been done for the rest of the channel manager rules,
and added some tests.

Migration script included.
Steps to reproduce the problem:

- Create a main contact.
- Create a child contact of the main contact, selecting a salesperson.
- Go to the main contact, and check the followers.

Expected behavior:

The main contact has the salesperson as follower. The same if editing
the child contact, the salesperson is changed.

Obtained result:

No follower for the salesperson.

That's because the `create` method is not intercepted to do the
followers synchronization.

TT39963
Currently translated at 75.0% (6 of 8 strings)

Translation: sale-workflow-15.0/sale-workflow-15.0-sales_team_security
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sales_team_security/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-16.0/sale-workflow-16.0-sales_team_security
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sales_team_security/
Currently translated at 100.0% (8 of 8 strings)

Translation: sale-workflow-16.0/sale-workflow-16.0-sales_team_security
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sales_team_security/it/
[MIG] sales_team_security: Migration to 17.0
…vironment.manage

Starting from v15, api.Environment.manage() is deprecated and its usage
should be simply be removed.

At least for v17 using it raises an error (for v15 a warning was raised
instead), so removing it is actually needed.
- Removed onchange methods, as user_id is now computed.
- Moved the hook to add followers to post_init_hook; in the forward port, followers were incorrectly added in uninstall_hook OCA#1794.
- Adapted the code and tests according to this commit odoo/odoo@d11691c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.