Files
odoo_source/addons/sales_team/tests/__init__.py
T
Thibault Delavallée e1355dae7a [REF] sales_team: improve crm.team.member model and data
GLOBAL PURPOSE

Ability to have salesmen belonging to several sales team is a core requirement
of CRM. It is therefore moved from website_crm_score to crm along with cleaning
and behavior improvement. Automatic lead assignment is also moved and cleaned.

SPECIFICATIONS: MODEL CLEANING

In this commit we improve team member model to make it more usable and
aligned with current Odoo views and usability.

This commit contains notably
  * add some related fields on the user: phone, mobile, company, email;
  * rename "team_user_domain" to "assignment_domain";
  * rename "maximum_user_leads" to "assignment_max";
  * improve member views globally;

We also introduce dynamic domain computation for users and teams when seeing
team members. This allows to limit selection of users or teams depending
on already existing configuration. Purpose is to avoid having people trying
to create wrong configuration (duplicates, ...) and receiving error messages.

Also
  * clean some data and demo about teams and members;
  * fix some views glitches;
  * improve views: add some fields in search views, improve wording of
    fields or actions, ... globally improve usability and US as well as
    feedback given to users;
  * group sales team members by team by default as it help getting an
    overview of team members distribution;
  * update tests to create team members instead of writing directly on m2m
    towards users;

SPECIFICATIONS: SALE_TEAM_ID FIELD ON RES.USERS

In this commit we also rewrite sale_team_id field of res.users. Previously in
crm it was simply a many2one field linking to a crm.team. It was used to compute
team membership as a standard many2one / one2many relationship. In enterprise
module ``website_crm_score`` this field was set as a related on first user
teams. Indeed scoring changed relationship between users and teams to a
many2many.

This field is now directly a computed many2one field that links to the
"main" team of the user even in multi memberships mode. As memberships can
now be de-activated we changed this field to a computed stored field. It is
based on oldest active membership of user. That way default team of documents
will be the user's oldest team considered as its "main team".

SPECIFICATIONS: LEAD_ALL_ASSIGNED_MONTH_COUNT

Improve crm_team ``lead_all_assigned_month_count`` field computation. It is
now simply the sum of assigned leads of team members. Differences may
happen if a lead in teamA is assigned to an user working in teamB. This should
not happen if team / user is correctly set at lead level which is generally
the case. However if that happens, old field counted it. New field will not
count it as it is not directly linked to a team's member.

SPECIFICATIONS: DEMO DATA

Make crm.lead demo data coherent with user_id / team_id . As demo data should
be using a mono-membership behavior for users and teams, we have to ensure
user_id and team_id effectively matches. It allows to have coherent reporting
and assignment demo flows.

Also avoid having Odoobot responsible of leads. Instead of undefined user_id
and team_id leading to Odoobot being responsible of some leads, force it
to be False. Those demo data allow to test automatic assignment of lead

LINKS

Task ID-2086889 (main task)
Task ID-2357969 (scoring migration task)
Community PR odoo/odoo#48422
Enterprise PR odoo/enterprise#499
Upgrade PR odoo/upgrade#996
2021-01-21 10:56:37 +00:00

8 lines
232 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import common
from . import test_sales_team
from . import test_sales_team_internals
from . import test_sales_team_membership