Commit Graph
8479 Commits
Author SHA1 Message Date
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
Fabio Barbero 65bb3a5710 [IMP] crm: set opportunity language to contact's lang
Purpose
=======

When creating an opportunity, set the language of the Lead/Opportunity
to the partner's language if it is set instead of leaving it blank.

Also update tests to correctly test lang propagation.

Update event_crm so that lang of lead from registration is directly set
to False when there is no partner. Indeed we have no clue which lang we
should set and we can skip the field computation that otherwise triggers
some additional queries.

Task-2709436

Part-of: odoo/odoo#81028
2021-12-24 14:57:02 +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
Florian Charlier dda6e65e15 [FIX] crm: fix priority stars alignment
Better aligns the stars with the label when no expected deadline is set,
by styling the parent div to space out non-empty children.

Task-2709761

closes odoo/odoo#81358

X-original-commit: 61925f488557181ae691d222a142a242c939d3e0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-14 09:11:23 +00:00
Julien Castiaux 42b522bd83 [FIX] *: cleanup manifest files
*: base_address_city, base_address_extended, bus, crm, im_livechat,
   l10n_ae_pos, lunch, pos_restaurant_adyen, test_assetsbundle,
   test_converter, test_lint.

It is spelled `auto_install`, the `complexity` key is long gone, `qweb`
has been moved to `assets: {'web.assets_qweb': []}`. `js` and `css` are
long gone too, `maintainer` is redundant with `author` which is
"Odoo S.A." by default already, the `certificate` key is long gone.

closes odoo/odoo#80988

Related: odoo/enterprise#22766
Signed-off-by: Julien Castiaux <juc@odoo.com>
2021-12-08 11:17:22 +00:00
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
Philémon van Helden 3b833c73a7 [IMP] mass_mailing, *: improve mailing stat buttons
*mass_mailing_crm, mass_mailing_sale 

Currently, the Mailing stat buttons have a few problems.
The business reporting smart buttons send the user to a list of linked records,
which doesn't provide much value (e.g. what is the user supposed to do with a
list of 12345 leads?). They also show wrong values depending on access rights.
The Mailing KPI smart buttons lead to a blank screen if there's no data to show.

In this commit, we add/adapt all action helpers to help users understand what is
going on. For the business reporting smart buttons we instead send users to
relevant reporting actions, so they can make sense of the data we showed before.
The values of the business reporting smart buttons are now calculated as a super
user.
We also change some domains from the whole UTM Sale Domain to only using
Source ID, which simplifies computation while staying accurate.

task-2604515

closes odoo/odoo#76798

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2021-11-30 16:53:33 +00:00
Aurélien WarnonandJulien Banken e70c203910 [IMP] crm: add small view improvements for crm.lead
This commit simply re-organizes a few fields on the crm.lead form view to give
more visibility to the most important information and to give more space to the
"Notes" section.

Task-2677144

closes odoo/odoo#80591

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Julien Banken <jbn@odoo.com>
2021-11-30 16:07:43 +00:00
David Beguin 75e9b2bff7 [IMP] crm: display lead reporting on all leads even if not group_use_lead
Purpose
=======

As a Lead Manager, I do not really care about what's in the "Lead Pipeline"
since this does not exist. Instead, I want to keep an eye on all the leads that
entered the CRM to see how well they are doing and how they are spread.

Specifications
==============

- Remove the group on the Reporting
	> Leads menu item, this menu can be used with Opportunities only

- Move it below the Pipeline report

- By default, this menu shows all crm.lead :
   - no matter the type (lead/opp) but with the filters in the search view
     if needed
   - no matter if won/active/lost (but again, filters allow me to change that
     if needed)
   - Default grouped by month creation date
   - Filtered on records created this year to avoid displaying 10 years of CRM
     usage - already done

=> The difference if I activate leads is that then I have the extra filters, ...
but this is already valid if I'm only working with opportunities

Also, on the report list view of the leads, this commit brings some small
modifications in order to have a better view of what kind of lead and 'where'
they are:
- Hide by default the "City" field
- Add "Type" field before "Probability" field (only if Leads are activated)
- Add "Stage_id" after "Type" field

Task-2671372

closes odoo/odoo#78748

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2021-11-26 15:58:01 +00:00
Patrick Hoste 2625132dd7 [IMP] crm: add default language when creating partner in crm lead
PURPOSE

After this commit when creating a partner the language will default
to the crm lead value.

LINKS

Task-2580065

Pr: odoo/odoo#76812
Related: odoo/enterprise#20689
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2021-11-25 11:38:39 +00:00
Thibault Delavallée 7c95dd9506 [IMP] sales_team, crm: add chatter on team member view to display trackings
Currently no chatter is added on team member form views. Indeed this model is
mainly technical and accessed through a dedicated menu in configuration.

However some fields are tracked and being able to see tracking information is
important in day to day dealing of team members. This is why we add chatter
on team members form view.

We also add context key to avoid autofollow when creating team members. As
chatter is mainly present for tracking and information no need to add extra
followers automatically. This causes unnecessary notifications.

Task-2679897

closes odoo/odoo#79356

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-24 10:18:24 +00:00
Aurélien Warnon 1e25946a76 [IMP] utm: globally improve UTM records management across all apps
PURPOSE

This commit consolidates UTM usage across all applications.

Global purpose is to avoid having undesired side-effects, such as unlinking an
utm.source/utm.medium/utm.campaign and at the same time cascading the deletion
to various records without noticing.

SPECS

ALLOW MORE PEOPLE TO CLEAN UTM RECORDS

Currently, not even the system administrator can delete utm.mediums and
utm.sources (he can only delete campaigns).

These were considered as "technical records", but allowing some cleanup is
a good idea since these records are often automatically generated and can
create a lot of unnecessary noise in the database.

That's why we now allow the following groups to delete all UTM records
(sources, mediums and campaigns):
- group_system
- group_mass_mailing_user
- group_social_manager (enterprise)

PREVENT DELETION

For some use cases, removing an utm.source/utm.medium/utm.campaign would
cascade delete the related record, which was unintended / hidden side effect.

These combinations were secured by preventing to unlink:
- mailing.mailing source_id field
  Trying to delete the utm.source will throw an error message
- mailing.mailing medium_id field
  Trying to delete the utm.medium will throw an error message
- hr.recruitment.source source_id field
  Trying to delete the utm.source will throw an error message

ADDING CLEAN ERROR MESSAGES

When trying to delete an UTM record that is linked with ondelete="restrict", we
improved the error message to give a clear explication to the user, e.g:

"You can't delete these UTM sources as they are linked to the following
mailings in the Mass Mailing APP, and deleting the source would break the
statistics: Newsletter"

SPECIFY 'ondelete' strategy

For a lot of uses of sources/mediums/campaigns, the 'ondelete' strategy was not
specified, leading to the confusion of "is this really how we want to handle
this?".

A lot of ondelete="set null" have been added in various field definitions to
ensure that this is the desired and logical strategy we want for that
specific model.

PREVENT REMOVING HARDCODED UTM RECORDS

In some functional flows, UTM records are hardcoded using their direct
record reference.
This is notably the case for the recruitment process and its creation of
aliases, and for the Email / SMS Marketing flows.

As deleting them would break these flows, we prevent their deletion in a
"api.ondelete" method.

ENFORCE NEW RULES WITH TESTS

A lot of python tests have been added to make sure we enforce the decisions
taken here above.

LINKS

ENT PR odoo/enterprise#19048
Task-2459480

closes odoo/odoo#72239

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-23 11:12:04 +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 d348c5e880 [IMP] crm, test_mail: flush tracking in tests involving tracking
Tracking is generated using commit hooks, meaning they are really sent when
the commit ends. This is done to ease values aggregation and accumulation
through various record updates. In some tests we therefore have to manually
flush the tracking, otherwise it is not created and posted. Notably tests about
lead lost wizard were not flushing and therefore not generated the tracking
messages. Those tests will be improved in future commits, cleaning them is
therefore a necessary step.

We also specifically add some tracking flush in mail performance tests. This
is to be sure we measure impact of a write and tracking separately from
previous transactions. Seems everything is working as intended as warmup and
query counters already perform flushes. Here we simply flush at the end
of the setup to be sure all base is clean before starting tests.

Task-2671709

Part-of: odoo/odoo#78648
2021-11-23 09:39:50 +00:00
Thibault Delavallée cd0c0d631b [FIX] crm: fix query counter in assign performance
In one week, this test failed about 4 times, seems mainly on nightly
enterprise. Let us update counter accordingly.

closes odoo/odoo#80164

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-22 11:56:50 +00:00
Thibault Delavallée 5a315a4364 [FIX] crm: ensure computation of PLS uses deterministic recordsets
closes odoo/odoo#79573

X-original-commit: 406270973250d05f1b9c63694b17391390f19c55
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 16:36:40 +00:00
Thibault Delavallée 6349319b0a [FIX] crm: fix randomness in assign tests
Seed is now fixed at beginning of each test to ensure random state is set
once for all and avoid random issues.

Task-2643740

X-original-commit: 85ebcaeaf909cd46743c20bf052360a65e60ea82
Part-of: odoo/odoo#79573
2021-11-17 16:36:39 +00:00
Fabio Barbero 1a9b6422ff [IMP] digest: organise digest view
Purpose
=======

Give the user a more organized view of the digest KPIs in the backend and
improve global wording of digest sections and KPIs.

Specifications
==============

Reorganize order of KPIs in digest view. Fix some typos, move buttons in
list and form views.

Task-2582128

closes odoo/odoo#77507

Related: odoo/enterprise#21340
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-16 19:20:57 +00:00
Jérémy Hennecart ebf8c735cf [FIX] crm: display only events linked to the actual opportunity
When an user clicks on the Meeting tab to open the calendar,
it should onyl display the events linked to the opportunity.

task-2665863

closes odoo/odoo#79860

X-original-commit: 5a6e6e9fdd5bc85e8c79c09ef17b63bf4b95dd39
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-16 14:34:20 +00:00
Dharmraj Jhala deba81203a [FIX] crm: set 'date_closed' while marking lead as lost
When lead is won/lost, 'date_closed' field should be updated. But since
recent commit[1], this field was not updated while marking lead as lost.

It used to work prior to commit because we used to set `active` and
`probability` together from `action_set_lost` method.

But now, won and lost action are handled with `toggle_active` method.
In case of the lost leads, it first sets the `active` field to False,
and the `date_closed` is correctly updated by write method. After that,
it sets the `probability` to 0, and during that the write method sets
the `date_closed` to False.

This commit fixes the issue by updating `date_closed` field from write
method, only if the `probability` is greater than zero, and thus not
discarding the already set value.

[1] - https://github.com/odoo/odoo/commit/9b76c6b7f1eec4057289de90d62b8a7a266b0aac

TaskID-2343223

closes odoo/odoo#79154

X-original-commit: 3b9db86b76a838c0ae6cc9d517d7a29bff2c0544
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-29 07:44:53 +00:00
ijas ahammed 920b673098 [IMP] crm: improve pipeline analysis report search view
This commit improve the pipeline analysis search for a better
usability. The changes includes:

- Rename 'My Opportunities' filter to 'My Pipeline'
- Move 'Opportunity' filter above 'Lead', rename it to
  'Opportunities', and display only if leads are activated
- Rename 'Lead' filter to 'Leads', and display only if leads are
  activated
- Remove the string from filter 'Creation Date', and use the
  default field name (which is 'Created On').

Also updated some filter names to have a global convention
and avoid name clashing, updated filter names are listed below.

- `opportunity` to `filter_opportunity`
- `lead` to `filter_lead`

As we need to display same filters and groupby in both community and
enterprise pipeline report search view, we have removed the search
view `crm_opportunity_view_search` from enterprise so that we can use
the community view there and both becomes the same view.

So in this commit we have also added some filters and groupby to
community version(`crm.crm_opportunity_report_view_search`) which was
existed in enterprise search view (`crm_enterprise.crm_opportunity_view_search`)
so that we dont miss any filters used in enterprise.

The filter and groupby added are listed below:
 Filter:
  - inactive

 Groupby:
  - compaign
  - medium
  - source

Apart from this, we have added groups `crm.group_use_lead` to the
groupby filter `conversion_date`.

Enterprise: odoo/enterprise/pull/18797
Upgrade: odoo/upgrade/pull/2937
TaskID-2343223

closes odoo/odoo#71796

Related: odoo/enterprise#18797
Related: odoo/upgrade#2937
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2021-10-28 15:27:27 +00:00
Thibault FrançoisandThibault Delavallée de10f6093f [FIX] crm: Fix lead multicompany issue
Context
-------

Leads get assigned a different company than the one defined on the salesman
after being merged with another lead.

This happens because some leads assigned to a user_id have no company set. They
are merged with leads that receive self.env.company during assigment to the
to the team and then get merged with the lead without company. So the company
of the new lead is written on the old one.

Behavior before this PR
-----------------------

When the crm.team have the field company_id = False
With the following flow

 1) Create a lead without a user_id and a team_id
 2) Assign a team to the lead
 3) Assign a user_id

The status of the company field on the lead is the following

 1) set the company of the env.user
 2) Keep the company of the lead
 3) set the user company if the current company is not one of the allowed
    company of the user

Behavior after this PR
----------------------

 1) set the company of the env.user
 2) set the company of the team even if it's False
    (so erase the company if the team has no company set)
 3) set the user company if the current company is not one of the allowed
    company of the user

Other changes
-------------

When resetting team and user: void company to avoid having leads without
any information but a company set. It eases assignment.

Task-2520276

closes odoo/odoo#78860

X-original-commit: ff2a6949c3a59be98cd1849e7a2e38c6ccc3187e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
Co-authored-by: Thibault François <tfr@odoo.com>
2021-10-27 06:39:50 +00:00
Thibault FrançoisandThibault François d3f35714f6 [IMP] crm: add tests for current MC behavior
Purpose of this commit is to highlight current behavior of multi company
in lead. Notably a company is set at creation even when no team or user
is set, leading to a lot of issues when dealing with lead merge or convert.

Task-2520276

X-original-commit: dc8d82bbe032cef2f732fdfb1ded3068edc37371
Part-of: odoo/odoo#78860
Co-authored-by: Thibault Delavallée <tde@odoo.com>
Co-authored-by: Thibault François <tfr@odoo.com>
2021-10-27 06:39:50 +00:00
Thibault Francois fc33e41719 [FIX] crm: fix typo in ValidationError
The validation error raise
"AttributeError: module 'odoo.exceptions' has no attribute 'ValidationEreror'"
Instead the the correct message
"Member assignment domain for user %(user)s and team %(team)s is incorrectly formatted

closes odoo/odoo#78943

X-original-commit: a7ae22d0206eb833d584755e55351c41a12fd274
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-25 15:50:54 +00:00
Aaron Bohy 3459aa9061 [FIX] crm: properly call super in forecast tests
Before this commit, those tests sometimes failed because we didn't
correctly wait for the load and reload promises.

X-original-commit: f62503a56c4ec5c3de6638c5fe2138330d217eac
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Florian Charlier 80ce93cd44 [IMP] crm: add expected closing date in tree view
It is more convenient to be able to keep an eye on the expected
closing date of opportunities.

Task-2668131

closes odoo/odoo#78399

Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-10-20 13:01:12 +00:00
std-odoo ef04bec628 [IMP] crm: merge the followers of the leads if they are active
Purpose
=======
When merging multiple leads, we want to move the followers to the
destination lead if they posted a message in the last 30 days.

A message will be added in the merge note to know which followers have
been added.

Task-2447721
PR odoo/odoo#75742
2021-10-19 15:58:58 +00:00
std-odoo be996fdc00 [IMP] crm_*: add more fields when we merge multiple leads
Purpose
=======
Add more fields when we merge multiple leads to be sure not lose
valuable information.

Specifications
==============
Those fields are propagated to the destination if the value on the
destination is Falsy
- referred
- color
- recurring_revenue
- recurring_plan
- function
- lang_id
- date_deadline
- reveal_id
- lead_mining_request_id
- reveal_ip
- reveal_iap_credits
- reveal_rule_id
- event_lead_rule_id
- event_id

The "lost_reason" field is propagated to the destination only if it's
lost (otherwise, it makes no sense to have a lost reason on a non-lost
lead).

The field "iap_enrich_done" is set to True if at least one lead has been
enriched.

We also keep the sum of all the lead tags (and remove any potential
duplicates).

The address is taken from the lead with the most non-empty address
fields (sorted by highest rank if multiple lead have the same amount
of non-empty fields).

Task-2447721
PR odoo/odoo#75742
2021-10-19 15:58:58 +00:00
std-odoo 6e7b50708f [IMP] crm: remove the groups attributes on the recurring revenue fields
Purpose
=======
This commit remove the "groups" attribute  on the recurring revenue
fields. Instead we hide them directly in the views. This group was used
only to turn on / off the feature, not for security reason. So it's 
fine to move the group in the views.

It will help for the lead merge so we will not be forced to use SUDO
during the merge.

Task-2447721
PR odoo/odoo#75742
2021-10-19 15:58:57 +00:00
Bruno Boi cc3403ad47 [FIX] web: action context pollution from session storage
Before this commit
An action retrieved from the session storage may not take into account
changes in the user context because the user context is duplicated in
the action context. When the user context changes i.e. through the
switch company menu (allowed_company_ids) and the browser reloads,
the action service will make the action context concatening the new user
context with the context of the action stored in the session storage,
which has still values from the previous user context.

After this commit
The makeContext function can now take an initial evaluation context.
This is then used in the action service in order to make use of the user
context when the action context is generated but without appending
it into the action one.

closes odoo/odoo#78415

X-original-commit: 7354d1686915ec21437fc677f15a6c5409106492
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-14 18:15:13 +00:00
Mathieu Duckerts-Antoine 85b8a95116 [REF] *: clean some useless %% in xml files
The commit https://github.com/odoo/odoo/commit/1b40e9265f88f57aaaf311bb8fae3d1fd1966d7d
allows to get rid of most escapings %% in xmls but there were still occurences
of useless %% in some of them. We remove them.

closes odoo/odoo#78069

Related: odoo/enterprise#21553
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-11 12:34:47 +00:00
std-odoo 2c198020f5 [FIX] crm: fix the rule based assignment
Bug
===
Since fe8c5b9b01 , if you have a team
with set to `assignment_max` and you try to automatically assign the
leads an error is raised.

Technical: in `_allocate_leads` we skip a team if `assignment_max` is
Falsy. So when we prepare the values for the notifications, the key
might not be present in the dict an error is raised.

Task-2658696

closes odoo/odoo#78054

X-original-commit: 7c46b441266ff0336bf86d10ac2ee45d2a2c2959
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-08 16:09:06 +00:00
Victor Feyens ab022ec12d [FIX] *: target v15.0 documentation with doc links
X-original-commit: acc95ec204baa1dddbe292c379a1768fe1deccbf
Part-of: odoo/odoo#77923
2021-10-07 17:59:52 +00:00
Martin Trigaux e132c36ee6 [I18N] *: export 15.0 source terms
closes odoo/odoo#77898

X-original-commit: ad5afb1d18661784bfcf51bca66e576de1f6c49b
Related: odoo/enterprise#21478
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-10-05 16:54:21 +00:00
dht-odoo 67bcdbb2a2 [IMP] crm: improve visibility of partner_id field in lead form view
When the crm.lead is of type 'lead', we don't want to display the
"Customer" field on the form view unless it's set (or debug mode).

Indeed, most of the times leads will not have this information set,
since when we assign a Customer we usually convert the lead to
an opportunity as well.

This means that on the lead form, we don't want to display this field
since it may be misleading for the end user.

When it's set however, we want to display it, mainly because there are
a few automatic synchronizations between the lead and its partner
(phone and email for examples), and this needs to be clear that modifying
one of those fields will in turn modify the linked partner.

Task-2596955

closes odoo/odoo#76233

Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-10-04 11:29:51 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Julien Mougenot 53f9b5f235 [REF] *: adapt modules to action and view contexts
This commit handles the adaptation of any component using the search
model's 'action' and/or 'view' key, now replaced by the environment
keys 'actionContext' and 'viewContext'.

Affected modules are:
- base_import
- board
- crm
- google_spreadsheet
- project

X-original-commit: 40f1ae87e1436192a70a8a7432eb72d379cfa6dc
Part-of: odoo/odoo#77463
2021-09-30 10:38:30 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Nikunj Ladava 5277316729 [IMP] {crm}_iap_enrich: enrich leads on creation for auto mode
Right now, when we choose to automatically enrich the leads from CRM
settings, it activates a cron to periodically enrich the leads using
IAP service.

This commit improves the behavior by enriching the leads after the
records creation using cron trigger. That way it is done nearly after
creation and user gets enrich information sooner.

To make it clear to users, the description for 'auto' mode is improved to
'Enrich all leads on creation'.

Also, now we select 'auto' mode by default instead of 'manual', and
display 'Enrich' button on form view irrespective of the selected mode
(if lead meets certain conditions) unlike before. Rest of the behavior
is still same as before. For example, we still have server action which
can enrich the selected leads in batch, which is useful if there are
existing leads before we enable 'Lead Enrichment' feature.

Task-2269743

Part-of: odoo/odoo#60605
2021-09-28 16:27:16 +00:00
Priyanka Kakadiya 38625a33a5 [IMP] crm: clean lead form view about Marketing information
This commit makes Lead and Opportunity form view cleaner with below
changes :

 * in Lead form view, renamed 'Tracking' group to 'Marketing'
 * in Opportunity form view, renamed 'Misc' group to 'Tracking'
   and moved 'Referred By' field to 'Marketing' group

Purpose is to better highlight important marketing information and better
label sections.

Task-2269743

Part-of: odoo/odoo#60605
2021-09-28 16:27:15 +00:00
Mathieu Duckerts-Antoine dabfb29301 [FIX] crm: forecast filters
The fix ff28db335fa77dadc did introduce some differences in the way
forecast filters work for a legacy or a new view. For example, let us
assume we have two filters F1 and F2 active in the same group with F2 a
forecast filter. In that situation, a legacy view would load with
domain = F1 domain AND F2 domain, and a new view would load with
domain = F1 domain OR F2 domain.

In the present commit, we harmonize the behaviors of ForecastModelExtension
and ForecastSearchModel as much as possible. We also make ForecastModelExtension
use a state received when it loads for the first time.

We have also taken the opportunity to normalize the states of the
extensions: it was not necessary to memorize forecastField (constant)
and forecastFilter (determined by the rest of the state).

closes odoo/odoo#77159

X-original-commit: 37aeb048c286f2f1a78370213635341c32ea621b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-24 14:00:38 +00:00
36988d0edc [IMP] *: use new dropdown in legacy too
This commit replaces the control panel dropdowns with the new <Dropdown/> component, in order to get consistent through the new/legacy views (because the current Odoo version is in a state where some views uses the new infrastructure and some others are still not converted - see odoo/odoo#73311).

The diff seems massive, but it is mostly due to tests adaptations.

closes odoo/odoo#77001

X-original-commit: d679cd0d8ba9a2420e81a42a698763e9be2327e1
Related: odoo/enterprise#21077
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-09-23 07:17:43 +00:00
nounoubensebiaandAurélien Warnon e2d11fa279 [IMP] [website_]crm: post crm.leads merge message using a full template
Use a template for merge post messages and clean how fields are displayed,
notably by fixing the display format, and the field order.

Indeed, previously posted lead merge message contained all fields in an
alphabetical order, even ones that had empty values, which is not very user
friendly in terms of display.

Now, the displayed fields are determined and ordered by sections, which greatly
improves understanding the various information.
Please note however, that it has the downside of not including all fields
anymore.

The merged leads information are included in a "read more/read less" enabled
block using the "data-o-mail-quote" feature to get a nice rendering and avoid
cluttering the Odoo chatter UI.

Within the sent mail however, the full text is directly visible when viewing
through a mail client.

Task-2451164

closes odoo/odoo#75946

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2021-09-22 12:22:32 +00:00
Mathieu Duckerts-Antoine 75f8814afd [FIX] crm, web: forecast views
After the conversion of the graph and pivot views done in https://github.com/odoo/odoo/pull/73311,
it was no more possible to open the forecast_graph and forecast_pivot views.
This is due to the fact that the new View component cannot manage a legacy
view: every extension of a converted view must be converted. We thus
convert forecast_graph and forecast_pivot.

closes odoo/odoo#76793

X-original-commit: ff28db335fa77dadc3198e754f1e0649811fba7b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 10:54:23 +00:00
Christophe Monniez 4dcd29284d [FIX] crm: disable hazardous tests in lead assignment
Some tests in this test class are leading to uncertain results and fails
randomly.

With this commit, the whole test class is deactivated until a fix is found.

closes odoo/odoo#76743

X-original-commit: 39545ba5b3c080ae3e651c4f9d25aa190582429a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-17 18:52:45 +00:00
Martin Trigaux ef8ad324b0 [I18N] *: export 15.0 source terms
closes odoo/odoo#76542

X-original-commit: 63e6807437295519a0f4705fb88644d6d557ca3a
Related: odoo/enterprise#20882
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-16 07:17:40 +00:00
Mitul Shah c1ea516aa7 [IMP] various: improves button titles for better command palette
Currently, in some of the important business objects' form views,
few header buttons are missing the title, and so the command palette
displays the button string which is not very clear/useful.

This commit improves the behavior by adding titles to the buttons. Below
are the model wise actions/methods linked with updated buttons:

 - preview_invoice (account.move)
 - action_sale_quotations_new (crm.lead)
 - action_set_lost (crm.lead)
 - action_set_won_rainbowman (crm.lead)
 - crm_lead_lost_action (crm.lead)
 - iap_enrich (crm.lead)

Task-2622266

closes odoo/odoo#75935

Related: odoo/enterprise#20680
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-15 07:48:06 +00:00
alt-odoo c80648f16c [FIX] crm: prevent division by zero in lead probability computation
If for some reason we cannot compute lead probability, we should simply
continue to the next value without causing a division by zero.

For example, this can happen if all stages are team specific, as there is
a current limitation regarding the first stage (used to know how many lost
and won there is) that requires to have no team assigned to it. This is a
side effect of the commit https://github.com/odoo/odoo/commit/cd291b79eb2d2df80899867263ec71438ab8fe87 introduced in V14, and we should add
a test to ensure we do not crash in that case.

closes odoo/odoo#76379

X-original-commit: 9793bb29fe6c4d0d59905b2fcfe78ebe51e17579
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
2021-09-14 10:51:14 +00:00