878 Commits
Author SHA1 Message Date
Paul Stroobant e7653c86aa [FIX] crm: restrict opportunity merge salesperson choice
Steps to reproduce issue:

1. Open CRM and select a list/tree view (opportunities or leads)
2. Select multiple records and try merging them (gear menu)
3. Click on salesperson field
4. Field dropdown contains portal users, should not be the case

Explanation:

`user_id` (salesperson field) in `crm.merge.opportunity` is a many2one related to res.users. Since it is not restricted, every existing user is listed in the selection.

Suggested fix:

In `crm.lead`, its homologous field possesses the domain formula `('share', '=', False)`.
https://github.com/odoo/odoo/blob/f987dd26e928bd0394cd0b835cc1d0fdd72e9234/addons/crm/models/crm_lead.py#L105-L108
Copying it into `crm.merge.opportunity` correctly restricts the users selection.

opw-3696148

closes odoo/odoo#153230

X-original-commit: e43d13d8aae2b46107237102e9f45a4c8e8e39df
Signed-off-by: Stroobant Paul (stpa) <stpa@odoo.com>
2024-02-09 08:54:51 +00:00
Maruan Aguerdouh (magm) 6afe525d93 [FIX] sales_team, crm: field template not missing for mobile view
Steps to reproduce:

- Install Contacts and Sales.
- Activate debug mode and go to contacts.
- Create new contact and get the mobile view inside the contact form.
- Go under Sales & Purchases and look for sales team.
- Try to change it in mobile.

The issue is that we were missing the template view for these specific
fields when on mobile, specifically we didn't had the proper kanban view
set for these fields.

opw-3323976

closes odoo/odoo#147365

X-original-commit: 52992f9cbd94aaea6d1500f20862bf2d6fa811ab
Signed-off-by: Jérémy Hennecart (jeh) <jeh@odoo.com>
2023-12-22 17:35:53 +00:00
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Julien Carion (juca) 6c412be2ea [IMP] *: coherent hotkey uses
This commit makes hotkey uses more coherent throughout the entire
codebase by setting alt+q as main shortcurt for confirm and default
actions and alt+x for cancel actions.

task-3370463

closes odoo/odoo#127469

Related: odoo/enterprise#43694
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-19 18:24:15 +02:00
Renaud Thiry 845111af36 [IMP] crm: remove set_reason toggle field
In odoo/odoo#124103 we stop using this field in the wizard.
It is thus removed from master.

task-3356095

closes odoo/odoo#124049

Related: odoo/upgrade#4743
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-06-15 17:36:20 +02:00
Renaud Thiry 629666c489 [IMP] crm: remove loss reason toggle
To set the lost reason you currently need to toggle a field
in the wizard if you are marking a lead as lost.

As the loss reason isn't technically necessary, we can just let users
choose whether to input anything or not without having to click anything

We also introduce groups so field strings are displayed.
As the first field cannot easily be implied
to be the loss reason anymore.

task-3356095

X-original-commit: b5181ea609f798e09e2032fe182e01fd07d1c10e
Part-of: odoo/odoo#124437
2023-06-09 13:49:57 +02:00
Renaud Thiry 31262f27a5 [IMP] crm: remove set_lost_with_reason action
This cancels the changes added to f91782279a
for minor version 16.3 as the server action is completely removed
instead of being fixed in this.

The action is not removed in the upgrade as it is still technically
working. Though it should be considered deprecated.

------------------------------------

We remove the action that was used to conditionally call a window action

The action was not called consistently and added confusing indirection.

To maintain the current behaviour of only suggesting adding a loss
reason for opportunities.
We make the reason fields toggleable in the wizard, and hide them by
default for leads.

This leaves the user with the option to add a reason anyway, and serves
as a confirmation wizard if they don't want to.

-------------------

task-3272955

closes odoo/odoo#118494

Related: odoo/upgrade#4640
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-10 10:18:46 +02:00
Renaud Thiry 1a25988101 [IMP] crm: replace context with explicit default
Prior to this we used the context active_ids directly to determine
which leads to mark as lost in the lost reason wizard.

We now use a m2m field to store that value to make the behavior more
obvious and predictable, and to ease debugging.

task-3272955

Part-of: odoo/odoo#118494
2023-05-10 10:18:46 +02:00
amdi-odoo b47f73bf4e [IMP] crm,crm_iap{_enrich}{_mine},*: improve UI
*: sale,sales_team

Improve UI of the CRM app:

- Add placeholders and underline m2o fields in the CRM quick create
- In the lead generation form, underline the industries field, add
the avatar widget on the user_id field, add the color attributes on
the tag field, add a placeholder for the states field and set a
longer selection field to avoid the caret from overlapping the content.
- In the opportunity form, align the expected revenue and probability
headers, set a longer width for the expected revenue field,
change the recurring plan placeholder.
- In the contact opportunities page, change the "Open Opportunities"
filter to exclude lost opportunities.
- In the Sales team page, add a groupby on the company_id.
- In the Sales team form, change the assigned lead count to be
a muted text, the pipeline checkbox should be visible only when leads
has been activated, the quotations/pipeline/leads options should be
aligned.
- In the lost lead modal, change the title from "Lost Reason"
to "Lost Lead" and the validate button from "Submit" to
"Mark as lost".
- In the Sales team member form, align the fields on the left and hide
the Create Employee field as it should not be displayed there because
this is not an hr module.
- In the lead analysis tree view, add the lost reason field with optional
hide.
- Align the enrichment company not found message to the left of the chatter.
- Update the crm iap lead role "Search More" list to display human
readable names instead of the technical names.

Task-3204763

Part-of: odoo/odoo#115326
2023-05-05 12:43:58 +02:00
thsh-odoo b8f847e03b [FIX] crm: improve layout of conversion modal
When converting a lead to an opportunity and merging with existing
opportunities, the list view showing opportunities is very tiny.

This is caused by the field not having the correct colspan, as its label is
hidden with the "nolabel" attribute.

This commit fixes it by assigning a colpan of 2.

Task-3179173

closes odoo/odoo#119790

X-original-commit: 6a003a12c92d215f8123538473eeb23a36e9ec7e
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-27 06:10:07 +02:00
Victor Feyens f4ea6d3226 [FIX] *: strict api for main orm methods
Enforce strict types for returned values for
* create
* write
* unlink
* default_get

to make those methods more consistent and reliable.
Also make sure they can be called with empty self/values,
i.e. that they follow the same behavior as the base methods
defined in the main orm Model.

closes odoo/odoo#116809

Related: odoo/enterprise#38880
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-25 15:20:43 +02:00
Maruan Aguerdouh (magm) ae412254f3 [FIX] *: fix kanban_view_ref to work in newer versions
Steps to reproduce:

- Install Sales.
- Go to any quotation and toggle mobile device mode in the browser.
- Go to Other Info > click in Sales Team field.

Issue:

We stop supporting the 'kanban_view_ref' in newer versions of odoo. So
we won't be able to get proper view.

Solution:

Changed the way we ref the kanban view to use context to get the
referenced kanban view.

Related to #39499

opw-3152174

closes odoo/odoo#116031

Related: odoo/enterprise#39499
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-20 13:03:32 +02:00
Martin Trigaux 69f911d994 [IMP] *: enforce usage of Markup in mail
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.

Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
  self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.

In
  self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer

Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.

closes odoo/odoo#111850

Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-13 16:39:48 +02:00
Louis Wicket (wil) 9afe7c74c9 [IMP] *: remove "French spacing" 👺
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#114533

Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-14 15:52:10 +01:00
Noe Antoine 2f7d95a75e [IMP] crm: underline datepicker field in PLS settings
Make the date field always underlined in the PLS modal in
the settings, to indicate that it is editable and not a
technical constraint.

Also rename confirm button to "update".

Task-3193113

closes odoo/odoo#114223

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-03-14 15:52:04 +01:00
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
Pratik Raval cc120c2141 [IMP] various: reduce wizards modal size
With this commit, the size of the following wizards will be reduced to medium:
\1 Schedule mailing (Email Marketing)
\2 Test mailing (Email Marketing)
\3 Lost reason (CRM)

taskID- 2701035

closes odoo/odoo#96500

Related: odoo/enterprise#29746
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-14 19:13:55 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Thibault Francois e26d3e1166 [FIX] crm: sale user should be able to convert and merge lead
Use case
--------

A sale user convert a lead to an opportunity, this lead has duplicates.

The wizard will convert and merge the lead. At the end of the process
the duplicated lead are delete.

Issue
-----

Before this commit the user get an access error because he cannot delete
leads

Since they can merge lead using the action "Merge" it's not consistent
and sales user should be able to merge lead during the conversion
as well

closes odoo/odoo#94699

X-original-commit: 3b79867460d9a407fba094fe1cd719d8d52011ef
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Thibault Francois <tfr@odoo.com>
2022-06-27 17:35:22 +02:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
Thibault Delavallée 25c4f406f7 [IMP] crm: avoid unnecessary partner update on convert
Currently when converting leads we may end up with False being compared to
a void partner recordset. Due to the use of != this leads to unnecessary
update of leads when no partner is involved in lead convert.

By comparing recordsets everytime we save queries and performance each
time a convert on a lead without customer is done. This leads to about
saving 150 queries in heavy duty tests.

Task-2722512 (Lead: performance in convert without customer)
Task-2722513 (Lead: performance master task)

closes odoo/odoo#81028

Related: odoo/enterprise#23094
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-24 14:57:03 +00:00
Rémy Voet (ryv) 3346008c43 [REM] core: remove useless view_init
The method view_init() is a hook called from default_get(). We can get
the same result by overriding default_get directly.

Part-of: odoo/odoo#79563
2021-12-24 14:56:56 +00:00
Thibault Delavallée 1341d52540 [IMP] mail, crm: allow to give a body to tracking
PURPOSE

Concatenate feedback message and tracking when marking a lead as lost. This
currently generates 2 consecutive message about the same change, having a
single one is better from an UI point of view.

SPECIFICATIONS

Allow to link a body to a value change tracking. Tracking is currently done
by accumulating changes in a structure (see ``env.cr.precommit.data`` usage
with ``mail.tracking.<name>`` key). In the end those values are used to
generate a message with tracking value and a subtype.

In this commit we allow to manually set a body used as a message for the
tracking message, adding a new ``mail.tracking.message.<name>`` key. It is
used when posting or logging the tracking message, simply propagated as body
to ``message_post`` or ``message_log``.

In crm we use this when losting a lead through the dedicated wizard. A bit
of custom html allows to have a nice display.

Task-2671709

Part-of: odoo/odoo#78648
2021-11-23 09:39:52 +00:00
Thibault Delavallée d1edc9e6a7 [REF] crm: correctly name lost_reason field on lead
As this is a many2one, it should end with an ``_id`` suffix. Otherwise we
may think this is a char field, which was probably the case at one point.

Task-2671709

Part-of: odoo/odoo#78648
2021-11-23 09:39:51 +00:00
Thibault Delavallée a830ceaaf9 [IMP] crm: allow to log a feedback when marking a lead as lost
PURPOSE

Allow sales reps to add a closing note to their lead while it is being marked
as lost. This is currently already done by a lot of sales reps but manually
with the "Log a Note" button.

SPECIFICATIONS

In ``Lost Reason`` model: add a new html field allowing to log a note on the
lost leads. Below the m2o, add an Extra Comment field where users can add a
"closing note". When the wizard is submitted, log this message as a note on
selected records.

Add tests, allowing to test both the wizard and this new feature.

Task-2671709

Part-of: odoo/odoo#78648
2021-11-23 09:39:51 +00:00
Thibault Delavallée 2f21e04e63 [REV] crm: remove unnecessary sudo
Revert "[FIX] crm: allow regular salesman to convert and merge opportunities"
This reverts commit 24db93c0e6b88f89fdf03d63afee05fc858ed977.

Indeed adding a sudo at the end of merge process is a strange way to fix
an unexplained issue about "similar emails". CRM code has been cleaned
since v14+ and flows should not gain random sudo trying to solve an
undefined problem.

closes odoo/odoo#75385

X-original-commit: b4fa19376eb50bf07b5753b4664fcad4d637bcec
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-08-20 12:08:26 +00:00
alt-odoo 055144d999 [FIX] crm: allow regular salesman to convert and merge opportunities
If an internal user does not belong to Sales / Administrator group, and wants
to convert a lead into an opportunity, he will face an access rights error if
another lead exists with the same email because we are trying to merge them.
We should allow him to convert and merge them without error.

closes odoo/odoo#75283

X-original-commit: 24db93c0e6b88f89fdf03d63afee05fc858ed977
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
2021-08-18 17:34:01 +00:00
Kevin Baptiste 86aa7b78aa [IMP] *: introduce data-hotkey on form and modal views
Define `data-hotkey` on most used action buttons.

For the modals, the following keys are dedicated for "special"
actions:
 - Alt+G: add
 - Alt+V: save
 - Alt+Z: cancel

closes odoo/odoo#73275

Taskid: 2588233
Related: odoo/enterprise#19464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-07-15 08:39:49 +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
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
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
dht-odoo 66b0fede39 [IMP] crm: improve update of probabilities from settings
Right now there is a button in the CRM settings called 'Update Probabilities'.
When clicking on it probabilities of leads created after certain date
are updated. Problem with this flow is that user can click on the button by
mistake and there is no going back.

Moreover this does not trigger a save on settings and changes done by user
are not saved. This is standard behavior of config settings.

This commit improves the behavior by opening a wizard on click of the button
instead of directmy updating the probabilities. It allows users to change
fields used in PLS, change start date, or even cancel the update process.

Task ID-2355562

closes odoo/odoo#60733

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-02-02 16:19:41 +00:00
Thibault Delavallée fdc02d7dcb [REF] sales_team, various: improve default team computation
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

Compute default team id for sales related documents. Note that this method is
not called by default_get as it takes some additional parameters and is meant
to be called by other default methods. Heuristic (when multiple match: take
first sequence ordered)

  1- any of my teams (member OR responsible) matching domain
  2- any of my teams (member OR responsible)
  3- default from context
  4- any team matching my company and domain
  5- any team matching my company

Note: ResPartner.team_id field is explicitly not taken into account. We think
this field causes a lot of noises compared to its added value. Think notably:
team not in responsible teams, team company not matching responsible or lead
company, asked domain not matching, ...

We also improve various places where sale team is computed on sales documents.
Purpose is to try to use same heuristic as much as possible in various
team_id fields.

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 12:22:09 +00:00
Thibault Delavallée fff19019de [IMP] crm: make some internal methods private
PURPOSE

Prepare sales team membership and lead assignment improvements by
reorganizing and cleaning some code bits.

SPECIFICATIONS

Tools methods should be private by default to indicate those are not part of
official convert or merge API for leads. In this commit we make convert and
merge tool methods private, keeping only main API methods public.

LINKS

Task ID-2428882
Prepares Task ID-2086889
COM PR odoo/odoo#64196
ENT PT odoo/enterprise#15610
2021-01-07 11:16:28 +00:00
mir-odoo fc348de003 [IMP] various: Do not allow create/open on country_id
Purpose of the task, is to prevent users from inadvertently
creation/opening countries from country_id fields.
Countries should be managed from their dedicated menu item.

so in this commit, we have set both no_open and no_create to True
so user should not update and create a country from the many2X fields.

closes odoo/odoo#63773

Taskid: 2241677
Related: odoo/enterprise#15464
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-12-24 12:51:04 +00:00
Thibault Delavallée 36c78e3e3a [FIX] crm: keep order of lead ids when mass converting
Purpose of this commit is to avoid the use of sets in convert wizard. This set
is used to compute ids of leads to merge and to convert. Using a set make order
impossible to predict. Using lists allows to have reproducible tests notably.

Spotted when working on task ID-2086889
2020-12-01 11:17:34 +00:00
Thibault Francois 6ce289606f [FIX] crm: don't bypass access right to find partner:
Problem
-------

Sales people can have restriction on partner they can see
Private addresses, multi company, ....

When they convert a lead to opportunity, it's currently possible
that the wizard will find and link a partner that the current user
cannot see.

Solution
--------
Field that are now computed store field, that were previously
normal field with onchange, should not be computed as sudo
to respect the record rule

closes odoo/odoo#59957

X-original-commit: 182fa38d7f28a92e7171c4ee3a42c8f73217b765
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-14 09:47:12 +00:00
Jérémy Hennecart a7906b282c [FIX] website_crm: fix compute on default
Now, compute's methods are executed on default, which leads to a crash
when these methods try to use the actual records but there isn't one
yet (e.g. at the creation of a record).

- Fix the traceback raised when creating a lead because of the
visitor_page_count method when self.ids is empty on default compute.

- Since the default_get() and the first_onchange() are also now combined,
we need to adapt the syntax of the default get for the field opportunity_ids,
replacing the array of ids by the command syntax '[(6, 0, ids)]'.

task-2325629

X-original-commit: acbc97bfe290ef3c7b8f7a1160266e49485099ae
2020-09-02 09:32:14 +00:00
Thibault Francois 3f0597a432 [FIX] crm: prevent data loss during conversion to opportunity
PURPOSE

Avoid automatic partner finding and update on lead to erase too much data.

RATIONALE

On crm.lead, the address fields, email_from and phone, are computed field
since saas-13.3 based on the partner_id. Previously they were synchronized
with an onchange on partner_id which was never triggered during automatic
flows on the lead.

Now computed field are triggered each time the partner_id is written.

Problems

- If someone uses the mass conversion with the action "Use existing partner
  or create", the partner is found for each lead with the method
  _find_matching_partner. This method can find any partner with a name that
  contains the lead name, the lead contact_name or partner name. It can find
  wrong partner. Previously, only the partner was changed and the contact
  information remained on the lead. Now, all the information are erased with
  the wrong partner information.

- If at creation all the address information are set and the partner_id
  as well, the address field from the partner won't be synchronized.
  The lead will end up with the address information we forced.
  During the conversion to opportunity, the partner_id defined on the
  lead, will be written again. It will trigger the synchronization
  of the address field on the lead. Those info can be incomplete or wrong
  You will end up with a data loss.

SPECIFICATIONS

Tell _find_matching_partner to match partner only based on exact email address
in the case of mass convert. Avoid fuzzy matching based on name likeliness.

During opportunity conversion, don't write the partner_id if the partner is
already the one set on the lead.

LINKS

Task ID-2316828
PR #55825
X-original-commit eed0a31e1e2c428c94dae4703c9575534a49ec1d
X-original-PR #55194

closes odoo/odoo#55838

X-original-commit: e82b5a92f44709592b25fa66d9555d64abef1ec9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-13 07:43:29 +00:00
Xavier Morel 6835aeb0de [REM] core, *: deprecate <act_window> and <report>
Convert deprecated tags through the codebase.
2020-07-28 13:03:13 +00:00
Victor Feyens 5dc8b7bdd8 [IMP] *: replace default_get overrides by default attribute on fields.
Leave the generic management of fields default to the orm as much as
possible.

* Default method is not called unless necessary.
* Default values are correctly post-processed by the orm when necessary.
2020-07-23 16:38:17 +00:00
Swapnesh Shah fde2b7a978 [IMP] crm: Improve field label
Improving field's string to make it alignes with all other fields in
Odoo.

closes odoo/odoo#44055

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-07-16 12:47:00 +00:00
Thibault Delavallée 9b76c6b7f1 [IMP] crm: better use toggle_active and add business behavior in it
Purpose of this commit is to make use of toggle_active to implement business
behavior linked to active field being changed. In CRM notably

  * when archiving: it is considered as lost, and therefore probability is
    set to 0;
  * when reactivating: void the lost reason and update probabilities for PLS;

In this commit we also update tracking subtype to more clearly track
lost / restored subtypes

  * lost: writing a lost reason (resetting it is not lost), archiving
    it if no other subtype;
  * restored: activating it again;

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:28 +00:00
Thibault Delavallée 540df68b32 [FIX] crm: do not erase activity_type_id field value when converting
activity_type_id is a related field on the first activity to do and should
probably not be reset / forced to a value. It is probably some code coming
from previous implementations of activities that were linked to crm only.

Coming notably from 87e457158e and 42226de46e .

Community PR odoo/odoo#48946

closes odoo/odoo#48960

X-original-commit: de2e682824a636062fbb2c47b1bf5d7c7cef18db
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-03 11:08:18 +00:00
Nicolas Lempereur b53cf339e4 [FIX] web,*: phone number ltr even in rtl language
Currently there is two ways in view to have a phone number displayed in
LTR in a RTL language:

- have `widget="phone"` on a field
- have a class o_force_ltr on the field

But this is currently done very rarely and fail in list view because the
direction of data cells is used, eg.:

```
<div style="direction:rtl">
  <table><tr><td style="direction:ltr">
      <span>+1 2 3</span>
  </td></tr><tr><td>
      <span style="direction:ltr">+4 5 6</span>
  </td>/tr></table>
</div>
```

will be displayed as:

+1 2 3
6 5 4+

In this commit, we use unicode-bidi* to optionally add an additional
level of embedding so direction is taken into account by the
bidirectional algorithm.

This commit also adds o_force_ltr class or phone widget on phone fields
where it is not already defined.

*: https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi

opw-2224828
closes #48425

closes odoo/odoo#48588

X-original-commit: ab067218e069f0a92610c3f0d4137e563e47755c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-30 13:50:04 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Florent LejolyandThibault Delavallée d13dba106c [REF] crm : use stored editable r+w fields
PURPOSE

Try to move from onchange / default_get to stored editable computed fields.
Behavior should be the same (computed or set by user), with support of
create / write / onchange field update without additional code.

SPECIFICATIONS

Update classic fields updated in some cases by onchange and/or default methods
by fields with store=True, readonly=False. It means their value comes either
from manual user input, either from trigger based computation.

Remove onchange and default_get when possible, leading to an unique computation
method and clearing fields definition.

Also clean some fields definition inconsistencies, notably required fields
that should instead be correctly computed or default that have no real meaning.

SPECIFIATIONS: CONSTRAINT USER_ID / TEAM_ID

In this commit we also remove all the better implementations of "not really a
constraint" constraint about user_id and team_id. Indeed as this is a computed
field normally we should not have to call the onchange manually, even through
a hackish call to a falsy constraint (see fdc8749, 222cca2, 4e8ebc7 ). You are
all inferior to SM team.

SPECIFIATIONS: DATE_OPEN

Assignment field, namely ``date_open``, has a random definition as it seems
linked to assignation, with several behaviors intended

  * ce39ca8a97 : reset only when going from
    no salesman to a salesman (aka, keep assignation when changing)
  * 8e540558ee: reset when changing salesman

We choose to keep first implementation as it seems a bugfix broken again
by second commit. It will also replace the ``assign_date`` defined in
``website_crm_score`` module.

SIDE EFFECTS

Several side effects occur with this commit. Indeed behavior is not always
exactly the same, notably as code rewriting allowed to fix some issues,
incoherent behavior or was simply not able to achieve exactly the same
result. Notably

  * at lead creation: default probability is the one coming from PLS and not
    0.0 anymore, since field is already computed. Synchronization with PLS
    still works the same way (change probability, you are out of syn);
  * various user_id / team_id combinations notably in convert / merge wizards
    may change, notably we do not reset team_id if user_id is reset. We
    consider we could keep a team_id set without user_id;

LINKS

Task ID 2088565 (crm: from onchange to compute)
Upgrade PR odoo/upgrade#781

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Florent Lejoly <fle@odoo.com>
2020-03-23 11:42:12 +00:00
Thibault Delavallée aeed763b03 [FIX] crm: improve duplicate finding when converting
SPECIFICATIONS

Improve heuristic used to find lead to convert duplicates

  * check email_normalized instead of email_from, as it may contain formatted
    emails. Normalized email are sanitized and normalized version of emails
    and ease comparisons;
  * use lead email if its customer has no email;
  * if no email is available but a customer is set, use it anyway;

This notably reverts 2917b38f28 . Indeed no reason has been found why
this fix is necessary.

LINKS

Task ID 2088565 (crm: from onchange to compute)
2020-03-23 11:42:11 +00:00
Thibault Delavallée 03afd0f2a1 [REF] crm: improve context use and naming of fields in convert wizards
SPECIFICATIONS 1: FORCE_ASSIGNATION

Move and rename force_assignation in convert wizard. Purpose is to move the
force_assignation field from mass convert wizard to its base convert wizard
used through _inherit. It allows to avoid relying on context propagation in
some methods. This field is also renamed as assignation as other meaning in
English.

SPECIFICATIONS 2: OPPORTUNITY_IDS

Improve search of duplicate by always ensuring duplicated are computed using
active_test. Also add the active_test on the field as otherwise computed
results are actually not visible to the user.

Generic opportunity_ids field is also renamed to better indicated it is used
to store duplicates and avoid thinking it holds data related to batch convert
or merge.

LINKS

Task ID 2088565 (crm: from onchange to compute)
Upgrade PR odoo/upgrade#781
2020-03-23 11:42:11 +00:00