diff options
| author | Florent Lejoly <fle@odoo.com> | 2019-08-21 08:54:05 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-08-22 09:17:42 +0000 |
| commit | 4aa1749699c26f8e804dfe3900e03fcaa363862a (patch) | |
| tree | 4a90688bd0aae3851f145da4900dee1c8937374d /addons | |
| parent | 8d0aee229364e9db36d5406b4b7a377f146e5f7c (diff) | |
[IMP] crm: improve stage messages, some strings and fix some typos
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
closes odoo/odoo#35308
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/crm/data/crm_lead_data.xml | 14 | ||||
| -rw-r--r-- | addons/crm/models/crm_lead.py | 8 | ||||
| -rw-r--r-- | addons/crm/views/crm_lead_views.xml | 6 | ||||
| -rw-r--r-- | addons/crm/wizard/crm_lead_lost.py | 3 |
4 files changed, 23 insertions, 8 deletions
diff --git a/addons/crm/data/crm_lead_data.xml b/addons/crm/data/crm_lead_data.xml index b654c1b6028..2ef4a9fea08 100644 --- a/addons/crm/data/crm_lead_data.xml +++ b/addons/crm/data/crm_lead_data.xml @@ -28,6 +28,12 @@ <field name="default" eval="False"/> <field name="description">Opportunity lost</field> </record> + <record id="mt_lead_restored" model="mail.message.subtype"> + <field name="name">Opportunity Restored</field> + <field name="res_model">crm.lead</field> + <field name="default" eval="False"/> + <field name="description">Opportunity restored</field> + </record> <!-- Salesteam-related subtypes for messaging / Chatter --> <record id="mt_salesteam_lead" model="mail.message.subtype"> <field name="name">Opportunity Created</field> @@ -59,6 +65,14 @@ <field name="parent_id" eval="ref('mt_lead_lost')"/> <field name="relation_field">team_id</field> </record> + <record id="mt_salesteam_lead_restored" model="mail.message.subtype"> + <field name="name">Opportunity Restored</field> + <field name="sequence">14</field> + <field name="res_model">crm.team</field> + <field name="default" eval="False"/> + <field name="parent_id" eval="ref('mt_lead_restored')"/> + <field name="relation_field">team_id</field> + </record> <!--Definition of an email template with an empty body that will be used in opportunity mailing. Used to give a basis for email recipients, name and to ease the definition of a further diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index c22fdba7f50..177d5f87761 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -483,9 +483,9 @@ class Lead(models.Model): # Actions Methods # ---------------------------------------- - def action_set_lost(self): + def action_set_lost(self, **additional_values): """ Lost semantic: probability = 0 or active = False """ - result = self.write({'active': False, 'probability': 0}) + result = self.write({'active': False, 'probability': 0, **additional_values}) return result def action_set_won(self): @@ -1154,10 +1154,12 @@ class Lead(models.Model): self.ensure_one() if 'stage_id' in init_values and self.probability == 100 and self.stage_id: return self.env.ref('crm.mt_lead_won') - elif 'active' in init_values and self.probability == 0 and not self.active: + elif 'lost_reason' in init_values: return self.env.ref('crm.mt_lead_lost') elif 'stage_id' in init_values: return self.env.ref('crm.mt_lead_stage') + elif self.active: + return self.env.ref('crm.mt_lead_restored') return super(Lead, self)._track_subtype(init_values) def _notify_get_groups(self): diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 2a14dc42b87..13bc5a5841d 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -93,8 +93,8 @@ attrs="{'invisible': [('is_automated_probability', '=', True)]}"> <i class="fa fa-gear" role="img" title="Switch to automatic probability" aria-label="Switch to automatic probability"></i> </button> - <small class="oe_grey" attrs="{'invisible': [('is_automated_probability', '=', True)]}"><field name="automated_probability"/> %%</small> - </span> + <small class="oe_grey" attrs="{'invisible': [('is_automated_probability', '=', True)]}"><field name="automated_probability"/> %% (Estimated by Odoo)</small> + </span> <div id="probability" class="o_row d-flex"> <field name="is_automated_probability" invisible="1"/> <field name="probability" widget="float" class="oe_inline"/> @@ -248,7 +248,7 @@ </group> </group> </page> - <page name="lead" string="Followup" attrs="{'invisible': [('type', '=', 'lead')]}"> + <page name="lead" string="Follow-up" attrs="{'invisible': [('type', '=', 'lead')]}"> <group> <group string="Contact Information"> <field name="partner_name"/> diff --git a/addons/crm/wizard/crm_lead_lost.py b/addons/crm/wizard/crm_lead_lost.py index b1d07199699..8f64a40579b 100644 --- a/addons/crm/wizard/crm_lead_lost.py +++ b/addons/crm/wizard/crm_lead_lost.py @@ -11,5 +11,4 @@ class CrmLeadLost(models.TransientModel): def action_lost_reason_apply(self): leads = self.env['crm.lead'].browse(self.env.context.get('active_ids')) - leads.write({'lost_reason': self.lost_reason_id.id}) - return leads.action_set_lost() + return leads.action_set_lost(lost_reason=self.lost_reason_id.id) |
