When simply need to parse a domain, it is easier
Add .strip() on ir.ui.view as ast.literal_eval produces an syntax
error if the node starts with spaces (as done in the xpath of
hr_attendance.view_employee_form_inherit_hr_attendance)
closesodoo/odoo#43831
Related: odoo/enterprise#7894
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit improves overall usability for lost reason wizard in CRM with
following improvements
* prevent deletion of reason if any lead is still referencing it;
* remove obsolete filter 'Include archived' for lost reason;
* add new stat button for lost reason, to see the leads that were lost
due to that particular reason;
* add margin on the reason title to avoid ribbon glitch;
TaskID 2176323
PR #43541
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Probably coming from a conflict / rebase / forward port. Or several of those
keywords.
LINKS
Task ID 2180521 (add tests for crm wizards)
Task ID 2056759 (remove crm.partner.binding mixin)
Task ID 2088565 (crm onchange -> compute)
Community PR odoo/odoo#43473
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Prior to this commit, two fields were used for lead and opportunities
count.
As both of these fields were set with the same values and only existed
for labelling purposes, this commit replaces them by a single field
and handles the the labels in the xml.
LINKS:
TaskID: 2086863
PR: #38707
Try to understand a bit this code with comments. Some unnecessary code is
removed, and some parameters are added to try to understand the various flows,
but main purpose is to understand that mighty spaghetti, not destroy it.
LINKS
Side effect of Task ID 2056759 (remove crm.partner.binding mixin)
Side effect of Task ID 2088565 (crm onchange -> compute)
Community PR #43127
Enterprise PR odoo/enterpreise#7656
Related: odoo/enterprise#7656
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit fixes 9ac5f42cd0c381bdddfd196721983057bab7028b by correctly calling the probabilities
computation method. It was a backport of a master fix and methods names are
slightly different.
closesodoo/odoo#42643
X-original-commit: 2e41f129ee39786c8259af792635e3b0f3dbfa3d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
SPECIFICATIONS
Fixes following issue: when a lead is marked as lost, the probability is
correctly set to 0 but not the automatic one. If one clicks on the "Set to
automatic", the probability is updated, which un-archives it without really
restoring it, meaning we get in a very strange state outside the expected flow
(no Won/Lost buttons, ...).
With this commit the automated probability is set to 0 when setting as lost.
Moreover restoring a lead recomputes its probabilities.
LINKS
Task ID 2092799
Manual backport of PR odoo/odoo#42015 done in master
PR odoo/odoo#42045closesodoo/odoo#42057
X-original-commit: 9ac5f42cd0c381bdddfd196721983057bab7028b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
In this commit we perform some small code move in order to better understand
the huge crm_lead.py file. Notably
* add some code sections headers (actions, PLS, opp/leads merge);
* move crm.lead.tag and crm.lost.reason in their own file;
* reorganize fields by main category because it is a mess;
* remove some unnecessary help messages on fields;
* merge two _auto_init methods definitions;
No functional change occur with this commit as it contains only some code
move.
It prepares some further technical cleaning in CRM application, notably
onchange -> compute move.
LINKS
Related to Task ID 2092799 (not really spec, spotted while working on it)
PR odoo/odoo#42015
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
CRM still holds code dead since more than 2 years about sales / crm dashboard.
Custom ugly un-onboarding not-wow headers have been removed at ea66192276.
LINKS
Related to Task ID 2092799 (not really spec, spotted while working on it)
PR odoo/odoo#42015
SPECIFICATIONS
Fixes following issue: when a lead is marked as lost, the probability is
correctly set to 0 but not the automatic one. If one clicks on the "Set to
automatic", the probability is updated, which un-archives it without really
restoring it, meaning we get in a very strange state outside the expected flow
(no Won/Lost buttons, ...).
With this commit the automated probability is set to 0 when setting as lost.
Moreover restoring a lead recomputes its probabilities.
LINKS
Related to Task ID 2092799 (not really spec, spotted while working on it)
PR odoo/odoo#42015
PURPOSE
Purpose of this commit is to allow users to look for leads and opportunities
by using the phone/mobile number fields. For example this allows salesmen
working in call centers to quickly retrieve all open opportunities of a
specific caller.
SPECIFICATIONS
Add a phone_search field allowing to implement a search on both phone and
mobile fields.
Allow searching independently from local format used to store the phone number.
Imagine we have leads with phone or mobile number that looks like ``+32 485 11
22 33``. We want to find this lead even when typing ``485112233``.
A custom search method is therefore implemented. It uses only the digits in the
phone or mobile number to perform the search.
A limitation is added on search having to contain at last 3 digits. Indeed
as it returns a domain whose leaf is ``[('id', 'in', ids)]`` it may be huge
for production databases.
LINKS
Task 2122873
PR #40131
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
When clicking on stat button "Meetings" on a partner, just highlight the
partner meetings as is done for similar stat button instead of having
a domain that hides other event (so when creating meeting, we can take
into account other existing meetings).
A similar change with same reasoning has been done for "Meetings" stat
button of hr.applicant records.
opw-2131494
closes#40812closesodoo/odoo#40900
X-original-commit: 957e7eb77ed18e4a1c14ef4ef55bd54503c56f44
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
-In CRM, click the CREATE button.
-Only enter a title for the new lead and directly click ADD.
-Click on the newly created lead to view its details.
Before this commit:
although a probability could be computed based on the stage of the lead, this
field has a default value and, at creation time, this value doesn't end up in
the list of values from which the `_write_probability` function decide whether
to recompute the probability.
After this commit:
The `_write_probability` function, renamed `_update_probability`, doesn't check
whether it should or not update the probability. It just does it. This function
is directly called in the `create`. `_should_update_probability` is called
before `_update_probability` in the `write`.
Task ID : 2081480
closesodoo/odoo#40411
X-original-commit: 483a94116629e418ebb224bad375747cf9ab3c1d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Prerequisites
- Configure a mail server (incoming)
- Enable leads in CRM app
- Create a sales team with a mail alias (ex: testcrm@odoo.com)
and check "Pipeline" and "Leads"
- Set a partner email with one of yours (ex: bob@odoo.com) /!\
- Send a mail from bob to testcrm
- In the incoming mail server click on "Fetch"
Reproduce the issue:
- Convert the generated lead to an opportunity
- Choose "Existing customer" and set another one than the actual
- The opportunity is created but the customer is the old one
Cause:
The given partner_id is overriden by the old one in the
`handle_partner_assignation` method.
This commit gives the priority to the new partner_id.
OPW-2089404
closesodoo/odoo#40031
X-original-commit: e1833936255839cd34eba5758ca4c3124fd2522c
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
Reproduce the issue:
- In the CRM app, create a lead/opportunity.
- Schedule a meeting for this opportunity via
the chatter and click on create.
- Go back, the "Meeting" stat button is now at 1
- Schedule a meeting for this opportunity via
the chatter and click on edit then create.
- Go back, the "Meeting" stat button is still at 1
Cause:
When we click directly on create, the opportunity ID is in the defaults
option but when we click on edit, there is no opportunity ID.
So, this commit use the context to retrieve the concerned opportunity
and set it if it is not already set.
I splitted the solution into a private method for a better readability.
OPW-2092920
closesodoo/odoo#39964
X-original-commit: 59d154dcc1524c8f08c6a1e7aee18c722ab2e0ad
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
Before this commit, the user could not edit the lead phone field
when a customer was assigned. The phone field was related to the
phone of that customer.
Now, the field related to the phone of the customer is removed.
We can edit the phone field of the lead without modifying the customer
one.
task-2083470
closesodoo/odoo#38350
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Currently, the "Opportunity restored" note appears while changing the tracking
field's value, which is incorrect.
The "Opportunity restored" title should only appear when the modification is
done by clicking on the "Restore" button.
Thus, make a condition proper to display this title "Opportunity restored".
task-2089784
closesodoo/odoo#39447
X-original-commit: 14453bf9dc6677056329b4599c798d6bf5273980
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before update
When we creating opportunity from lead and select option 'linked with existing
customer', partner information is not filled up in followup section.
After commit
When we creating opportunity from lead and select option 'linked with existing
customer', partner information is correctly filled up in followup section.
This commits fixes that behavior by calling onchange_partner_id when converting
a lead to an opportunity.
Task ID 1974504
closesodoo/odoo#33073
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Somehow followup of dbb6cfdbf8 . Purpose is
to use formataddr from tools instead of manually handcrafting the full
email address format. Indeed the tools one correctly encapsulates and
format name and email.
Task ID 2068986
When Lead is duplicated, `stage_id` should not be copied for obvious reason.
Indeed it should go through the pipeline again, with probably and stage_id
being freshly computed again.
closesodoo/odoo#37927
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit it was not possible to enrich leads manually as
only a cron enriches leads. It is considered as sub optimal since people
would like to do it manually on some leads and not activate it only for
all leads, using a cron.
After this commit an option is added in CRM settings to choose the type of
enrichment: either manual, either automatic.
In manual mode, a button appears on the lead to enrich if certain conditions
are met (email_adress present, not already enriched,...). It also deactivates
the enrich cron.
In automatic mode, the button on lead is not displayed and the cron is
activated.
A config parameter is defined in CRM as it is requested to be able to configure
it directly in CRM without having to first install the app then configure
it. A post install hook to synchronize cron status with config parameter
is therefore required.
FP/AJU request
Task 2075817
closesodoo/odoo#37367
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
when runnning the PLS cron, only the automated probability was updated
with the new values.
But dissociating probability and automated probability
(for the leads that were in auto mode), breaks the autom mode and set
implicitelly the mode to manual.
(as probability and automated_probability are not equal anymore).
This commit update also the probability only in the case both fields were equal before
the cron process.
Task ID: 2044539
PR #37413
When there are only few leads, marking a lead as won or lost changes
a lot the won/lost repartition. For onboarding purpose, the cron is launched
if the threshold PLS config param is not reached.
When the number of lead in the database reaches the PLS threshold,
the config parameter is set to 0 to avoid the useless check
of the number of lead in the dabase in the future
Task ID: 2044539
PR #37413
If the stage is set to won, automated probability should = 100%
Without forcing it, it should be the case as all lead at stage won
have been won. (thanks Captain Obvious!)
But if a user mark as lost a lead that is at won stage, it will reduce the
probability of the won stage.
Also, if the cron didn't run recently, it could be that the autmomated probability
will give the same result than in previous stage (if no lead have been won at all).
Task ID: 2044539
PR #37413
This commit
- removes probability default value in order to activate
Bayes predictive lead scoring by default
- set the default pls start date to today - 8 days
to include all demo data in PLS computation
Task ID: 2044539
PR #37413
Since it appears that email validation feature from Flanker v0.9.0
is completelly broken (the lib explodes when calling
address.validate_address('some@address.xxx')), Flanker is then removed
and email validation will be done only using the email_normalize method.
Task ID: 2044539
PR #37413
This commit applies multiples things:
- Fix PLS settings that were not loaded correctly (was not using technical field names)
- Add data for PLS settings to check all optional fields and set the start date.
- use null value instead of empty for phone and email state fields to lessen the DB storage
- set pls start date required
Task ID: 2044539
PR #37413
Indeed since a lot of cleaning has happened, notably merging lead and
opportunity views and actions cleaning, let us have a real name for
that main action instead of a bad and error-prone name.
Task 2070287
closesodoo/odoo#36676
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
In order to prepare the send mail to visitor that are linked to leads,
getting lead by confidence level must be factorised to avoid code duplicates.
Task ID: 2056080
PR #36290
PURPOSE
Allow auto install of all SMS-based feature. Move partner onchange formatting
directly inside phone validation.
SPECIFICATIONS
Move the onchange on the phone field of contact model directly inside phone
validation to have it available in all SMS based applications.
LINKS
Task 2061765
PURPOSE
Allow the user to enrich a lead based on the domain of the email address of
the client.
SPECIFICATIONS
Following fields will be populated if found using clearbit and if they are
not yet populated :
* description
* partner_name
* reveal_id
* website
* street, street2, zip, city, country_id, state_id
* phone (using the first number found in clearbit)
* mobile (using the second number found in clearbit, else the same as phone)
A message will also be logged in the chatter.
If no data is found using clearbit no credit is used and a message will be
logged. If the user has no credits he will be redirected to buy credits for
the service.
It is possible to enrich using the 'enrich' action in listview or with a
cron that will run every hour on leads not older than 1 hour.
Add a "Lead Enrichment" setting in CRM installing lead enrichment.
LINKS
Task 193185
closesodoo/odoo#36419
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
As part of the back2basics, the stage messages were modified to be clearer
* when an opportunity is lost previously 2 separated messages where
created in the chatter (one for the reason, one for the active state)
now, one message is created with both infos;
* new message when an opportunity is restored;
There where also some fixes to typos, and an the probability of a lead
to be successful received a new title "estimated by Odoo".
Task 2026297
closesodoo/odoo#35308
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This branch is the combination of several optimizations in the ORM:
* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;
* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;
* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);
* make method `modified` take advantage of inverse fields to inverse
dependencies;
* filter records by evaluating a domain on records in Python;
* a computed field with `readonly=False` behaves like a normal field
with an onchange method;
* computed fields are computed in superuser mode by default.
Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.
closesodoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
When redirecting to record, the wrong 'form' view will sometimes be
loaded. A 'hack' has been done in crm_lead.py to redirect the user to
the relevant 'form' view based on the value of the 'type' field.
However, this solution is not clean as it does not solve all cases
(multiple crm.lead records loaded from the activity systray, reloading
the page after redirection, etc.)
Goal of this task is to solve those issues by merging crm.lead.form.lead and
crm.lead.form.opportunity form views. That way multi records actions will
always display the relevant information according to record type.
Note: Here some fields used as a twice in the form view just to stay
close to the current design. Still few things which are not possible
here for 'lead' and 'opportunity', that is
* A dynamic 'placeholder' on 'name' field.
* A 'domain' on 'partner_id' field.
* A 'widget' on 'probability' field.
Task 47118
closesodoo/odoo#32248
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
In this commit useless code is removed
* method 'close_dialog' and 'edit_dialog' from crm.lead;
* actions: crm_opportunity_report_action_graph,
create_opportunity_simplified, crm_lead_action_activities,
merge_opportunity_act;
* views: view_create_opportunity_simplified
Indeed this is dead code and can be removed to clean a bit module.
Task 47118
Since introduction of website_visitor,
we don't need to identifiy the lead with a lead_id cookie.
The visitor is identified and if a lead is created with the
contact form, the lead is created and linked to the visitor.
To avoid losing data, each time a visitor send a contact form,
it creates a new lead. All those leads are linked between them
via the website_visitor.
As the website_visitor already has the lang set on itself,
there is no reason to keep the lang_id of crm_lead at enterprise
side. So that lang_id on crm.lead has been moved to community.
This commit is directly linked to another one in enterprise
See https://github.com/odoo/enterprise/pull/4834 to get more details.
Task ID : 2028059
PR #34624
When the many2xxx field relates to a model where company_id is required, set
this domain [('company_id','=',company_id.id)]
When the company_id field of the related model is not required, set this domain
['|',('company_id','=',company_id.id),('company_id','=',False)]
When setting the domain on a field which is in the treeview of a xxx2many field
evaluate against the company_id of the 'parent'.
Some constraints have been added on sereval models. Take a look at the complete
specification for more details.
TaskID: 2024446
Closes: #35266
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Module module_crm_phone_validation and its checkbox from py and xml file
because the module crm_phone_validation is moved to module crm since f60825b439 .
Also moved label of phone_international_format to help directly inside settings
view in order to have a nice looking configuration page.
Task 2036270
closesodoo/odoo#35377
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This attribute is misleading as it is insufficient to correctly upgrade
the database. It only renames the column in the database, but other
operations are needed, like updating the corresponding `ir.model.fields`
record (and its xmlid). The default values and the translations are also
lost during the upgrade.
Moreover, this feature was misused. It was:
- left on fields during multiple versions.
- used on reports (SQL views). This would be ok if the feature was
complete, but, as is, it was useless.
- kept unchanged after a second renaming of the field (which can happen
versions later the first rename).
- used, even when the meaning of the field changed. i.e. the field
`archived` has been renamed to the classic `active`, but the value
in the database should be switched.
The following models are already using big images, or they might need big images
in the future:
- partner
- hr employee
- shop category
- lunch product
- gamification badge and karma rank
PR: #34925
PURPOSE
This commit removes the mass_mailing.campaign model. Instead of having a fully
fledged model, we will simply inherit utm.campaign. We will also add relevant
statistics on utm campaign model in order to use it in various applications.
SPECIFICATIONS
This commit adds leads/generated statistics in the kanban and
the form view of the utm campaign.
Kanban and form views will now display the number of leads and
opportunities generated with the campaign
TaskID: 2002029
PR: #34452
Now we can deselect all the optional fields to compute the predictive
lead scoring.
Task 2028666
closesodoo/odoo#34614
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Commit f60825b439 moved phone validation addition on res.partner model
from a specific module to crm directly. However the inherit from the validation
mixin class was forgotten, leading to a crash when changing phone from the UI.
closesodoo/odoo#34545
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>