Commit Graph
8535 Commits
Author SHA1 Message Date
dht-odoo 586ae4bcc4 [IMP] crm: improves description field type from text to html
Replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).

Models -> Fields

1) crm.lead -> description
2) event.event -> note

Task Id: 2499504

X-original-commit: 524e2f089a611d897b98d86001bda5d17263db66
2021-06-07 05:24:08 +00:00
Julien Banken f0f1cf3902 [FW][FIX] crm: fix incorrect prefix removal from phone filter
When the user searches a phone number, the search function will generate
a pattern by removing the "+" sign as well as well as the prefix "00" from
the input string.

Problem:

If the input string starts with "+", it means that the phone number will
be prefixed by something different than "00". As the function will
systematically remove the first occurrence of "00" from the input string,
the function can remove part of the input string that does not correspond
to a prefix. The search results can hence be incorrect.

Example:

If the user types "+32485001122", the function will remove the "+" sign
and the first occurrence of "00" from the input string. In the provided
example, the function will search phone numbers matching with the pattern
"324851122" which is incorrect.

Solution:

The function should remove the first occurrence of "00" iff the phone
starts with "00".

Task id: 2479277
COM PR: odoo/odoo#69729

closes odoo/odoo#70954

X-original-commit: 53b4a7cf045df8828716e31e6d2a56cf93123bba
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-07 05:32:25 +00:00
nounoubensebia c89c5ff3ed [FIX] crm: rearrange settings
Move the lead mining section to the top right as we now have a lot more empty
space after the removal of the outlook plugin settings

Task-2531032

closes odoo/odoo#71544

X-original-commit: 1cb0c743c4c15d6817773d66a7ac27321b8bbada
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-01 12:10:21 +00:00
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Leonardo Pavan Rocha c53724ebc3 [IMP] *: adds generic user avatar
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.

Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient

Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.

closes odoo/odoo#69819

Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-01 14:36:23 +00:00
dht-odoo e33ef69e7d [FIX] crm: fix UserError message while merging leads
This commit fixes the UserError message by properly displaying the
number of maximum leads that can be merged.

Apart from that, this commit also hides 'email_from' and 'phone' fields
on merge wizard to avoid scroll and to make sure that the 'x' icon is
always visible, which previously was far right and user had to scroll
a bit for removing the lines with that button.

TaskID-2542260

closes odoo/odoo#71523

X-original-commit: abbf3419767c149f338a4a48f15c2af7dfbed2bc
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-01 09:00:39 +00:00
Anjali a99d882c02 [IMP] crm,*_crm: better merge leads side documents
Purpose of this commit is to ensure side documents are redirected to the
master opportunity when merging leads. Those side documents include

  * communication history (mail.message);
  * attachments (ir.attachment);
  * visitors (website.visitor);

However some documents are currently not specifically handled :

  * meetings (calendar.event);
  * activities (mail.activity);
  * sale orders (sale.order);
  * attendees (event.registration);

In this commit we ensure all are attached to the final master opportunity.
That way we prevent loosing access to those documents and ensure we keep
the complete history of all merged leads.

Also tests are added to ensure the merging of leads and its contents.

A new field is added to have the o2m field between leads and calendar events.
In order to clarify naming, ``meeting_count`` is renamed to
``calendar_event_count`` to match naming.

Task Id-2457941
COM PR odoo/odoo#68884
UPG PR odoo/odoo#2494

Related: odoo/upgrade#2494
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-28 12:12:51 +00:00
Thibault Delavallée 962d8a443b [FIX] crm: set lost leads as last when sorting by confidence level
When sorting by confidence level, put lost (inactive) leads last. This should
not happen when using the merge tool that filter out inactive leads but may
happen in case of manual merge.

Task Id-2457941
COM PR odoo/odoo#68884
2021-05-28 11:49:02 +00:00
yograj tandel e893651cec [IMP] *: remove widget='selection' from many2one fields
Currently, across Odoo, there are around 40+ many2one fields defined with a
'selection' widget. Since the many2one widget has options to limit record
creation and opening, there is no reason to define a many2one field with a
selection widget. The selection widget does not allow for searching, and is
limited to 100 records.

PURPOSE
to update the definition of any many2one on which we applied a 'selection'
 widget, and instead use the standard many2one widget with disabled
opening/creation instead.

after this commit,
for each many2one field defined with widget="selection",  widget="selection" is
replaced with options="{'no_open': True, 'no_create': True}"

Task : 2476488

closes odoo/odoo#68387

Related: odoo/enterprise#17316
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-20 11:01:28 +00:00
Victor Feyens 0348b95aee [FIX] *: update documentation links
Following the recent reorganisation of the documentation in 12.0+,
the majority of the documents have been moved and their old links are no longer valid.
Some redirection rules will soon be deployed, but those rules might be dropped in some years
and we want the links to still work, which is why we still replace the links to the new ones.

FW-Port of odoo/odoo#70675 (13.0)

closes odoo/odoo#70920

X-original-commit: bc9c1eef538ba6095e74c19d5d9ed9e01625ec7c
Related: odoo/enterprise#18361
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-05-17 19:26:27 +00:00
Anjali a0ddf651b8 [FIX] crm: fixed form view for leads in reporting
When clicking on "CRM -> Reporting-> Leads (Leads Analysis)" list and form
views are not correctly set, leading to opportunity views. In this commit we

  * have changed the list view from ``crm_case_tree_view_oppor`` to
   ``crm_case_tree_view_leads`` to ensure we use the right view;
  * we are now able to open form view from the list view like all other views;

When clicking on "Teams -> Reporting (on a team vignette) -> Leads" list
view used is the opportunity one. We fix it by correctly setting action
views for ``action_report_crm_lead_salesteam`` reporting action.

Task-id : 2497936

closes odoo/odoo#69575

Related: odoo/enterprise#18338
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-17 10:28:38 +00:00
nounoubensebia d01e5c5cdb [IMP] calendar, crm, hr_holidays: move meeting stat button to calendar
Move the meeting stat button and kanban pill from CRM to Calendar, purpose is to
allow its usage even if CRM is not installed as this makes more sense since this
field is usually related to Calendar.

Increase query number limit in company leave test, in order to take into account
the newly introduced query in Calendar.

UPG-PR: https://github.com/odoo/upgrade/pull/2423

Task-2514473

closes odoo/odoo#69846

Related: odoo/upgrade#2423
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-28 14:05:07 +00:00
Thibault Delavallée d4fd55a931 [FIX] crm: fix query counters: 2 tests sometimes at +3 on runbot
/shrug

closes odoo/odoo#70794

X-original-commit: 84d0cd28a4d701ae509d6152759a64942dcf5c2e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-12 19:51:23 +00:00
Thibault Delavallée 8cf094ed0d [FIX] crm: improve assign test asserts
Purpose is to avoid randomly failing tess depending on how leads are allocated
through teams. We achieve that purpose by

  * creating more leads, easing their repartition through teams;
  * adding a lower and upper bound test for team allocation to ensure weights
    are globally ok;
  * changing member assign domain to fit more closely test lead data;

We also improve test by using the ``crm.assignment.commit.bundle`` config
parameter that has an impact on lead duplicates removing and therefore
performances.

LINKS

Task ID-2528906
COM PR odoo/odoo#70756
Followup of Task ID-2489951 (assign process improvements)
Followup of odoo/odoo#70172 (smoother assign process)

X-original-commit: 8fdf97b6498adc0a2fb15e360ebbbaa1672534e5
2021-05-12 19:51:22 +00:00
Thibault Delavallée c6cba59de8 [IMP] crm: add assignment optout test
Add a test ensuring ``assignment_optout`` works as intended. Salespersons
being opt-out from assign process should not receive any leads. This replaces
setting ``assignment_max`` to 0 (which is still a working trick). This commit
is a followup of odoo/odoo#68476 (done in a rush), and done in a specific
commit to avoid messing with forward-port.

Task ID-2497077
COM PR odoo/odoo#70664

X-original-commit: 813016e77b6abf9032059725a8725f693b132b58
2021-05-12 14:23:55 +00:00
Thibault FrançoisandThibault Delavallée eca1b7aeaf [IMP] crm: ensure constant lead filling when assigning
PURPOSE

All unassigned leads should be assigned to teams as soon as possible to ease
lead analysis.

Purpose of assign thresholds is to ensure sales people receive at least this
amount of leads within 30 days, counting lost and won leads. Giving them leads
regularly is also one goal of automatic assign.

SPECIFICATIONS

Counting every lead whatever its state may lead to an inconvenient situation.
If a salesman always reaches its maximum every days he will always receive the
number of lead he got 30 days ago. For example if the salesman goes in holidays
for few days and set the max to 0 he receives no lead during his vacation.
Then after a few days of assign he reaches its maximum and receive 0 leads
for a few days. This leads to having windows of leads that repeat themselves
every 30 days.

   * Solution: do not limit at maximum capacity anymore. Compensation is voided
     if limit is achieved. However asked assignment is done. Salesman could
     receive more than its max capacity but 30 days window ensure old leads
     are regularly going out of count.

``assignment_max`` is now more a mean target of leads to be assigned during
a 30 days window than a real maximum capacity. Field is renamed accordingly.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: 3d1841f26ce64f0106122e48750d2c653ea9790f
Co-authored-by: Thibault François <tfr@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-05-12 14:23:55 +00:00
Thibault Francois fe8c5b9b01 [IMP] crm: change in assignation process and limit
PURPOSE

All unassigned leads should be assigned to teams as soon as possible to ease
lead analysis.

Purpose of assign thresholds is to ensure sales people receive at least this
amount of leads within 30 days, counting lost and won leads. Giving them leads
regularly is also one goal of automatic assign.

SPECIFICATIONS: TEAM ALLOCATION

Team assignment has to be updated as we may have team domains that overlap.
We therefore remove maximum number of leads to allocate to teams. Instead all
available unassigned leads are allocated within teams.

  - Solution: assign all available leads and not a count based on team's
    capacity. This notably reverts the main goal of odoo/odoo@6df2f0cfc0
    (see odoo/odoo#48422)

This assignment process is done proportionally to the team capacity. It is
computed as the sum of each member's maximum assignment counter. This means
that with a team having twice as much sale capacity than another team sharing
the same domain: first team should receive about 2/3 of leads while the second
one should receive the remaining 1/3.

  - Solution: assign lead one by one. Choose a team randomly using a weighted
    random algorithm, based on team's members capacity.

SPECIFICATIONS: MEMBER ASSIGN

Counting every lead whatever its state may lead to an inconvenient situation.
Moreover salespersons may opt-out from assign by setting their max capacity
to 0, for example when going on holidays.

When doing that lead assignment is not smooth and getting back to a full
pipe may take several days. To solve that issue a compensation is added in
assignment quota done to sales people. Salespersons having few leads will
get a boost in assign as soon as they get back in assign process. When being
near maximum compensation is nearing 0 and daily quota is given.

PERFORMANCE

During team assignation, assigning lead one by one may cause performance issue.
Since PLS is computed at each flush, so we want to flush after a bunch of lead.
To solve that we obviously need to not commit at each assignation but
also avoid to search for duplicate at each assignation, that why the
search for duplicates is done at the beginning of the process and stored
in memory.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: 83f72711e7affa8b0ad997b9ee262326e9577d54
2021-05-12 14:04:03 +00:00
Thibault François 74d6455cdb [IMP] crm: better support cron time configuration
When running the cron is should assign leads based on its frequency. If cron
runs once every day, work_days given to sub methods should be 1. If it runs
more than once day it should be less than 1. We therefore remove the *2
multiplier and support fraction of days.

As assign process will soon change, assigning more strictly compared to
salespersons capacity will not be an issue anymore. Assign process is best
designed to run every few hours (~4 times / day) or each few days. Code and
work_days are updated accordingly.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: c59ba43d1e9eb0c016b9a113c9475dec28fa413b
2021-05-12 14:02:23 +00:00
Thibault FrançoisandThibault Delavallée 05316742c0 [FIX] crm: correctly filter out won and lost leads for assignment
Automatic assignment is performed on leads that are unassigned and not won
nor lost. This commit fixes the condition that should be based only on
stage being set to a stage with ``is_won`` being True.

Current code fails with won unassigned leads that are assigned even if it
should not. This happens rarely as won leads have probably been taken care
of. However having the right condition ensure filtering won and lost leads
is not correctly done.

Followup of odoo/odoo@5016b47a06 (see odoo/odoo#48422)

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: d9fe86ec2ca6459a34b31e65c0702d8a80a7ec61
Co-authored-by: Thibault François <tfr@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-05-12 14:02:22 +00:00
Thibault FrançoisandThibault Delavallée 99bc9420a5 [REF] crm: use a duplicate cache when assigning to teams
PURPOSE

Purpose is to try to reduce friction between searches in loops, team assign
on leads and unlink during merge process that unlink leads and forces flush
/ cache reset, as well as PLS computation.

SPECIFICATIONS

During team assignment setting team on leads one lead at a time may cause
performance issue. As PLS is computed at each flush we want to flush after
a bunch of lead. For that purpose we need to avoid too much commits and
also avoid to search for duplicate at each assignation.

We therefore perform the search for duplicates before going into allocation
and use a cache through loops to ease using pre-fetched information.

Unlinking duplicates at each iteration is also sub efficient as it causes
recomputation or invalidation. We therefore aggregate all duplicates to
unlink and unlink them in the main team-based loop instead of the sub loop
that is lead-based.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: c5310102210fb9afc6ab786f4c8f6eaf5aee59bb
Co-authored-by: Thibault François <tfr@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-05-12 14:02:21 +00:00
Thibault François f2ff222fba [FIX] crm: keep team when assigning and deduplicating leads
New leads are automatically assigned to sales team and salesman during assign
process. Some of those leads are duplicates of existing opportunities. If a
new lead is merged into an existing opportunity, the opportunity is the master
data and the lead is duplicated. However the opportunity should keep its sales
team and not be assigned to the team being under automatic assign.

Before this commit, the merge was forcing the crm team to the 'current' team
during auto assignment and thus it was changing the team of the opportunity.
In this commit we now assign team to lead to merge before the merge and do
not force the crm team during merge process.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: 356a55053eb1cc49ae6eed0e58338cff08eddc42
2021-05-12 14:02:19 +00:00
Thibault François d92ca08fd7 [IMP] crm: count all leads in `lead_month_count` used in assign
PURPOSE

Goal of ``assignment_max`` is to make sure sales receives this amount of leads
within 30 days. Counting lost or won leads is therefore necessary to effectively
count all leads received those last 30 days.

SPECIFICATIONS

Change ``lead_month_count`` computation to take into account archived and won
leads. We consider now that goal of ``assignment_max`` is to make sure sales
people receive this amount of leads within the 30 days at max.

This allows to avoid archiving leads to get a new batch of leads to handle.
Also done leads should be counted as it is part of the month job.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: 23feb1a467e0a441eb775be26c96af697d74506f
2021-05-12 14:02:15 +00:00
Thibault François 6106642cb5 [IMP] crm: use stage instead of probability to exclude won duplicated leads
Change domain of ``_get_lead_duplicates``: lost and not win lead currently
means lead with a probability != 0 and != 100. This is not always accurate as
you may have a lead with 100% win probability but that is still not won.
Instead search for active lead and with stage_id.is_won = False .

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: 31e8d3cf03025085b5ae9db67536a1110bf3e484
2021-05-12 14:01:28 +00:00
2f829b0e28 [REF] crm: cleanup test environment to prepare changes in assignment process
This commit contains two main preparatory changes in tests

  * 1) lead_month_count will be changed to count lost lead as well. So
    archiving leads before running the test doesn't reset the counter.
    Lead needs to be unlinked in order to make tests reproducible;

  * 2) assertMemberAssign checked the validity of the team domain. Normally
    all lead assigned to the member should match the domain of its team.
    This assert is not always verified since we force the team after a
    merge of duplicated leads. Final merged lead may not match team domain
    anymore as final properties depend on all merged leads.

Some tests are also added :

  * add tests for master lead team_id and user_id values when merging leads
    in assign process;
  * add tests using email_normalized check in duplicate finding to ensure that
    normalized emails are used for duplicates and not only exact match;
  * add tests for won / lost inclusion in ``_get_lead_duplicates``, as well
    as different between probability=100 and stage.is_won = True . This is
    going to change in upcoming commits, hence some test to highlight it;
  * add tests counting existing leads for assignment purpose;
  * add tests for assignment_max maximum leads allocation as well as max=0
    meaning salesperson is opt-outed from assign;
  * add tests for default user / team / stage computation for leads;
  * add tests about leads taken into account in assign process (currently
    failing with won unassigned leads);

We also add some flush to ensure some fields notably related to probabilities
are flushed before counting queries.

LINKS

Task ID-2444908 (assign fixes)
Task ID-2489951 (assign process improvements)
COM PR odoo/odoo#70172

X-original-commit: bd3444085974f4e12287c2f5da4fb33308cd6180
Co-authored-by: Thibault François <tfr@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-05-12 14:00:58 +00:00
Thibault Delavallée 71f19d55fa [FIX] phone_validation: add country trigger on sanitize phone computation
If country is updated on a record inheriting from mail.thread.phone
its sanitized number should be computed again. Indeed without this
trigger it is not computed and may lead to inconsistencies between
phone numbers and sanitized number.

Task ID-2528169

closes odoo/odoo#70734

X-original-commit: odoo/odoo@d00b291167
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-12 13:59:36 +00:00
Thibault Delavallée a8fafbf02e [FIX] crm: correctly compute phone_sanitized without having crm_sms installed
Currently phone_sanitized computation on lead model works only if crm_sms
is installed. Indeed an override of ``_phone_get_number_fields`` is missing.
However ``_sms_get_number_fields`` coming with ``crm_sms`` and its ``sms``
dependency hides the issue as those modules are auto-install. However if
``crm_sms`` is uninstalled phone_sanitized is not correctly computed anymore.

Task ID-2528169
Oversight of odoo/odoo#45315

X-Original-Commit: odoo/odoo@45ae2922e5
2021-05-12 13:35:03 +00:00
Martin Trigaux 41d8b8cf68 [I18N] *: export saas-14.3 source terms
closes odoo/odoo#70673

X-original-commit: bcb9ff784e44462384b0a43a0a23eed7a1111bc5
Related: odoo/enterprise#18269
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-11 12:28:28 +00:00
dht-odoo 12469ef4d3 [IMP] various: improve the sequence of menu items
- Currently all menus are out of order in app switcher.
- For example, Sales app is 16 menu away from Accounting,
  Social Marketing app is 25 menu away from Email Marketing, etc.
  So, all menus should be reordered.

- This commit will reorder the menus of the app switcher in order to reduce
  the distance between correlated applications,
  and bring the most common apps upward.
- And in this commit we have left gap of 5 subsequent sequence for further new menus.

PR: #69984
TASK ID: 2513082

Related: odoo/enterprise#17989
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-07 05:54:18 +00:00
Thibault Delavallée d978b9e1c0 [IMP] various: update query counters according to latest runbot run
Base: seems related fields take only 1 extra query instead of 3

Crm: assignment seems to have been slightly improved. Some randomness still
happens.

Hr Holidays: seems it was further improved beyond space frontier

Hr Work Entry Holidays: seems it was further improved

Test mail: those tests were a bit random, seems random is gone (hopefully)

Test mail full: updated local counters

Test mass mailing: seems we gained one query, updated local counters

closes odoo/odoo#70504

X-original-commit: 8c215b3d60929166b3e60e2a4dfb2a6c70439046
Related: odoo/enterprise#18194
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-07 08:18:04 +00:00
Raphael Collet f934b29a8a [REF] core: speed up the retrieval of fields on models
Fields are no longer retrieved with inspect.getmembers(), which is
time-consuming.  Instead, the classes defining models automatically
collect their own fields (via Field.__set_name__()), and the field
retrieval is done by using those collections.  Also, a field no longer
needs to introspect its model class to find its field definitions.

A class that defines a model automatically determines its '_name',
'_inherit' and '_module' upon creation, and the fields determine their
'name', 'model_name' and '_module' via Field.__set_name__().

Loading a registry with 290 modules from scratch is now 25% faster.
2021-05-03 12:33:29 +00:00
Thibault Delavallée 6c7dd7501a [FIX] crm: do not reset action name in convert wizard each time an option changes
Currently ``name`` field that holds the action type is recomputed each time
duplicated leads are updated. However duplicated leads are often updated
notably each time customer action (create / link / do nothing) and chosen
customer are updated.

As ``name`` compute method is mainly present to replace a default value
its compute method is updated so that it nows compute only when not having
a value. Once having a value user choice is kept.

Task ID-2452777
COM PR odoo/odoo#68618

closes odoo/odoo#70254

X-original-commit: d75905f7acb1e7584d01792b4880fa76e6920d56
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-03 11:51:27 +00:00
Nasreddin (bon) 29398abb4e [FIX] crm: display right partner and action when converting lead
Issue
	- Create a partner with email 'aaa@test.com'
	- In CRM settings, activate 'Leads' feature
	- Go to CRM -> Leads and create a Lead:
	- Set email field to 'aaa@test.com'
	- Click on 'Convert to opportunity'

	Neither the action or partner_id field is set to the right value.

Cause

	Due to missing 'lead_id' field in template, the partner_id field
	is not recomputed since action is not recomputed.

Solution

	Add 'lead_id' field as invisible in form.

opw-2439722
Task ID-2452777
COM PR odoo/odoo#68618

X-original-commit: 6915d17f5f10737c03c820b69eded3a7c0151907
2021-05-03 11:51:26 +00:00
Simon Genin (ges) ecfe85db84 [REF] web: static/src/(img|fonts) => static/(img|fonts) 2021-04-29 07:34:40 +00:00
Thibault Delavallée effebe148f [FW][FIX] mail, various: fix document access link computation
Purpose of this commit is to fix computation of access link. In some cases
msg_vals modification leads to invalid URL computation, notably for frontend
or backend differentiation for target recipients.

Followup of odoo/odoo#63292 .

Task ID-2513724
COM PR odoo/odoo#69607
ENT PR odoo/enterprise#17849

X-original-commit: e618597876692f2d24f8e9308c747b8d1f2d8905
2021-04-23 15:24:58 +00:00
Julien Banken 0bc56aa7a2 [IMP] phone_validation: improve mobile/phone search
PURPOSE

This commit aims to simplify the phone filter of the lead search view
to better manage phone numbers containing letters.

SPECS

The current phone filter will remove all non-digit characters from the
input string. When the user enters an american phone number containing
letters, the filter can sometimes return phone numbers that do not match
exactly with the provided input string.

eg: If the user types "hello123" in the search bar, the filter will
return all phone numbers matching with "%123%". This pattern will indeed
match with "hello123" but it will also match with many other phone numbers
containing only "123".

To fix the issue, the phone filter will no longer trim all non-digit
characters from the input string. The filter will be more standard and
will better manage phone numbers containing letters.

LINKS

Task ID-2424185
COM PR odoo/odoo#64078

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-23 13:15:49 +00:00
Julien Banken 4b8c55697c [IMP] crm: add tests for phone / mobile search
This commit aims to add tests to ensure current behavior of seach on
mobile/phone field. Some unsupported cases are commented to highlight
current feature state.

LINKS

Task ID-2424185
COM PR odoo/odoo#64078
2021-04-23 13:13:47 +00:00
Qiuyu (QHO) bd67479316 [REF] mail, mail_bot, im_livechat, *: convert JS files to ES6 modules
task id: 2487514

closes odoo/odoo#69376

Related: odoo/enterprise#17749
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-19 13:33:35 +00:00
Sunil Shrimali 612845686c [IMP] crm: add probability on lead tree view
Currently, in crm probability field is not displaying
in lead tree view. with the removal of lead scores,
the probability is now the tool we want users to see
as their "quality indicator" for their leads.

With this commit, we now display probability field
(optional="hide") in lead tree view, also probabilty
label changes to "Probability (%)" in Leads and Pipeline
Tree view.

closes odoo/odoo#68680

Taskid: 2496347
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-12 14:07:52 +00:00
Noe Antoine 335701b35e [IMP] crm : develop a smart calendar view from crm opportunity
Before, when the user clicked on a crm opportunity "meetings" smart button,
the calendar view was centered on the present day, and with default mode
(week, month,...) as a scale. This behavior leads to calendar views that
were possibly not including those meetings.

This smart calendar improves this by computing the target date and the scale
to make sure that the user is taken to the useful time period when using the
smart button from crm opportunity. The meetings considered are only the
relevant one, that is only the ones not finished yet, if there are some, and
all (finished) meetings otherwise. The calendar works as follows :

 -If no meetings: show current week
 -If one: show that week
 -If more than one and same week : show that week
 -If more than one and same month : show that month
 -If more than one month, show month of the first meeting.

This is done according to user language week_start and timezone. This way
the user always see what is the most relevant.

Also added python tests in class TestCRMLeadSmartCalendar.

Task ID-2431245

closes odoo/odoo#64807

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-01 18:59:48 +00:00
Thibault Delavallée 389d74fab3 [IMP] crm: allow team members to opt-out from assign
Purpose is to allow members to quickly opt-out / opt-in from assign
process. For example if for some reason (leaves, too much leads, temporarily
working on something else) a salesperson cannot handle more leads he may
opt-out from assign process.

When member is opt-out, hide assign details from both kanban and form
views. It allows notably to see at a glance who is out and who is in.

Task ID-2494749
COM PR odoo/odoo#68476
UPG PR odoo/upgrade#2318

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-30 14:41:16 +00:00
Julien MougenotandSimon Genin 03641610c2 [REF] *: convert all modules to new asset system
Conversion of all modules to the new manifest assets declaration.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:18 +02:00
nounoubensebia 6c81ee556f [REF] [crm_]mail_client_extension, base_setup, crm[_iap_lead_enrich], iap: split mail specific and crm specific code
- split the mail_client_extension module onto two modules:
  1) module mail_client_extension having mail/contact specific code,
  depends on iap and contacts only
  2) module crm_mail_client_extension having crm specific code,
  depends on CRM and mail_client_extension.

  Purpose is to allow the user to use the mail_client_extension
  without needing to install CRM, this will also allow
  the usage of the mail connector in other modules without
  the need for CRM.

- add the module_mail_client_extension field to the
  res_config_settings model of the base_setup module
  in order to enable the user to install the
  mail_client_extension module directly from the settings

- move the crm_lead model from the mail_client_extension_module
  to the newly created crm_mail_client_extension_module, as this
  model is no longer needed by the mail_client_extension module
  because it no longer not implemants CRM functionality

- move the iap_enrich_api model from the crm_iap_lead_enrich
  module onto the iap module as it is only related to contacts
  and not to CRM, this way it can be used in other modules such
  as the mail_client_extension module without the need for CRM
  module

Task-2382870
UPG-PR: https://github.com/odoo/upgrade/pull/2156
COM-PR: https://github.com/odoo/odoo/pull/66139
2021-03-29 11:59:11 +00:00
Aurélien Warnon 2bf049fd50 [FIX] crm: reposition tooltip to avoid resize flicker
The tour bubble "animation" that makes it to bounce up and down can cause
issues when its position is at the edge of the bottom of the screen.

In the CRM tour, this would make the window constantly resize to show a
scrollbar and then resize to hide the scrollbar, creating quite a sickening
effect visually.

While waiting for a more "robust" solution on the framework side, we solve this
occurrence of the issue by simply moving the tooltip position on top of the
button instead of below it.

Task-2476595

closes odoo/odoo#68470

X-original-commit: cdb7a8ad7647649ad8f595454aa9dc0464117568
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-29 13:16:41 +00:00
Ipsita Borisagar 7e5ee53035 [FIX] crm: avoid to display false in case of void subject
Before this commit:

If there is no subject for message, it effectively displays "False" in case of
void subject.

After this commit:

If there is no subject for message, it will not display "False" in case of void
subject.

Tasks-2156170

closes odoo/odoo#68243

X-original-commit: 4b2f0ddcbe859ec8453e537aec9d5b0685876eca
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-23 13:52:19 +00:00
Munaf Khan 8f88307c18 [FX][FIX] crm: prevent email_from propagation if only formatting differs
Before this commit when we update the email_from field on lead with only
formatting differing from partner a warning ribbon was displayed. It
considered email had changed and had to be propagated. Moreover unnecessary
update on partner was done to propagate the new email onto the customer.

In this commit we propagate email only if normalized versions are different.
It means that if lead email_from is "Hermes Conrad <email@example.com>" and
partner email is "Jonathan Conrad <email@example.com"> no update from lead
to partner is performed. Indeed normalized versions are the same.

Task ID-2461308
PR odoo/odoo#66890

X-Original-Commit odoo/odoo@3dd972c35b

closes odoo/odoo#67859

Related: odoo/enterprise#17191
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-22 07:52:19 +00:00
Thibault Delavallée 700929d1a4 [FW][IMP] crm: improve phone / email tests for lead / partner sync
Purpose of this commit is to improve phone, email and mobile synchronization
tests for lead / partner. Notably

  * mobile is not synchronized: only a void mobile is set to partner's mobile
    when changing partner. It is not synchronized back onto partner;
  * email / phone are correctly synchronized;
  * phone_sanitized is computed on both lead and partner based first on mobile
    then on phone. It means records having the same phone numbers could have
    different phone_sanitized values if mobile numbers differ;

Task ID-2461308
PR odoo/odoo#66890

X-Original-Commit odoo/odoo@0adecd9a6e
2021-03-22 07:44:05 +00:00
Thibault Delavallée 7991118bfe [REF] mail, various: remove support of channels from message_subscribe API
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``channel_ids`` argument and support from ``message_subscribe`` and
``message_unsubscribe`` API. Indeed we do not support adding channel-based
followers anymore. Only partners should be added or removed from followers.
It also allows to simplify API and understanding of both methods.

Various addons are updated to match the simplified (un)subscribe API. Some
enterprise addons may also be impacted.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:11 +00:00
Noe Antoine 374134a04c [IMP] crm: inline email and phone sync warnings on crm lead
Reduce eye catchiness of warning message when warning the user that
his changes on email and phone will also update customer.

Before, used a ribbon (ribbon_message). It is removed from crm lead model
and also of crm lead form view.

Now, only displays an orange alert sign at the end of the fields when a change
would update the customer profile. Hovering on the alert sign displays
the appropriate message. The warning icon is added on crm lead view for
both lead and opportunity types.

Python compute method of ribbon field is split in two compute methods,
one per boolean field partner_email/phone_update.

Also updates ribbon_message tests accordingly.

TaskId 2456105
COM PR odoo/odoo#66909
UPG PR odoo/upgrade#2258

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-15 16:16:59 +00:00
Aurélien Warnon cd117b15d4 [IMP] crm: improve crm.lead kanban ribbon display
Since e86f892a7b

We have the possibility to display a "lost" and a "won" ribbon on the crm.lead
kanban view.

In this commit, we change things around a bit:
- The "WON" ribbon was removed.
  Since it was redundant with the stage anyway and not very useful.
- The "LOST" ribbon is now always displayed in the kanban view.
  And not only when coming from "duplicate leads".

In addition, leads displayed when coming from the stat button on the
res.partner form view now also shows lost leads (active_test=False).
This can be helpful for the end user because he wants to know "all the deals
that are in progress/lost/won with this specific contact".

Task-2349526

closes odoo/odoo#67693

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-12 09:38:35 +00:00
Nasreddin (bon) 84d5099ac0 [FIX] crm: allow any users to see event with privacy="Everyone"
Issue

	- Create a database with 2 users
	- Open the calendar application and create a meeting for you and the other user
	- In the option:
	  set Privacy to 'Everyone'
	  set Show times as 'Free'
	- Send the invitation to the other user

	Access Error (rule: Hide Private Meetings)

Cause

	The 'calendar_event_global' ir.rule is deprecated and related ir.rules
	are now in calendar module (crm.meeting -> calendar.event).

Solution

	Remove rule since deprecated.

opw-2469433

closes odoo/odoo#67706

X-original-commit: c2a3fdbc42e042440695c8a3fc3e657d910d2d5c
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-03-11 16:15:03 +00:00