[IMP] crm: usability improvements

Purpose : Various relabelling and design improvements in crm:
- opportunity, lost reason, lead, team, tag forms
- hide "convert to opportunity" button for inactive/lost
leads (actually nothing happened when clicked anyway)
- Checkbox in crm.team to hide all alias related fields
- New many2one field appearing in crm.team form to select the user to
whom lead created by alias will be assigned.
- Set the admin as leader of the initial crm.team

closes odoo/odoo#28851
This commit is contained in:
Geoffroy Larue
2018-12-03 14:12:43 +00:00
parent e1e0826eee
commit 87ab98832e
8 changed files with 63 additions and 32 deletions
+1
View File
@@ -7,6 +7,7 @@
<field name="alias_name">sales</field>
<field name="dashboard_graph_model">crm.lead</field>
<field name="company_id" eval="False"/>
<field name="alias_user_id" ref="base.user_admin"/>
</record>
<!--default alias for leads-->
+4 -3
View File
@@ -78,7 +78,7 @@ class Lead(models.Model):
description = fields.Text('Notes', track_visibility='onchange', track_sequence=6)
tag_ids = fields.Many2many('crm.lead.tag', 'crm_lead_tag_rel', 'lead_id', 'tag_id', string='Tags', help="Classify and analyze your lead/opportunity categories like: Training, Service")
contact_name = fields.Char('Contact Name', track_visibility='onchange', track_sequence=3)
partner_name = fields.Char("Customer Name", track_visibility='onchange', track_sequence=2, index=True, help='The name of the future partner company that will be created while converting the lead into opportunity')
partner_name = fields.Char("Company Name", track_visibility='onchange', track_sequence=2, index=True, help='The name of the future partner company that will be created while converting the lead into opportunity')
type = fields.Selection([('lead', 'Lead'), ('opportunity', 'Opportunity')], index=True, required=True,
default=lambda self: 'lead' if self.env['res.users'].has_group('crm.group_use_lead') else 'opportunity',
help="Type is used to separate Leads and Opportunities")
@@ -937,7 +937,7 @@ class Lead(models.Model):
def get_empty_list_help(self, help):
help_title, sub_title = "", ""
if self._context.get('default_type') == 'lead':
help_title = _('Add a new lead')
help_title = _('Create a new lead')
else:
help_title = _('Create an opportunity in your pipeline')
alias_record = self.env['mail.alias'].search([
@@ -1189,7 +1189,8 @@ class Lead(models.Model):
# do not want to explicitly set user_id to False; however we do not
# want the gateway user to be responsible if no other responsible is
# found.
self = self.with_context(default_user_id=False)
if self._uid == self.env.ref('base.user_root').id:
self = self.with_context(default_user_id=False)
if custom_values is None:
custom_values = {}
+3
View File
@@ -40,6 +40,9 @@ class Team(models.Model):
('stage', 'Stage'),
], string='Grouping Method', default='day', help="How this channel's dashboard graph will group the results.")
alias_user_id = fields.Many2one(domain=lambda self: [
('groups_id', 'in', self.env.ref('sales_team.group_sale_salesman_all_leads').id)])
def _compute_unassigned_leads_count(self):
leads_data = self.env['crm.lead'].read_group([
('team_id', 'in', self.ids),
+1 -1
View File
@@ -49,7 +49,7 @@ tour.register('crm_tour', {
}, {
trigger: '.modal-body .o_field_many2one',
extra_trigger: ".o_opportunity_kanban",
content: _t("<p>You will be able to customize your followup activities. Examples:</p><ol><li>introductory email</li><li>call 10 days after</li><li>second call 3 days after, ...</li></ol><p class='mb0'><i>Select a standard activity for now.</i></p>"),
content: _t("Choose an activity type.<br/>You can customize them in the general settings."),
position: "bottom",
run: function (actions) {
actions.auto('.modal-footer button[special=cancel]');
+38 -20
View File
@@ -9,9 +9,18 @@
<field name="arch" type="xml">
<form string="Lead Tags">
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name"/>
</h1>
</div>
<group>
<field name="name"/>
<field name="color" groups="base.group_no_one"/>
<group>
<field name="color" required="True"/>
</group>
</group>
</sheet>
</form>
@@ -46,7 +55,7 @@
<form string="Leads Form">
<header>
<button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
help="Convert to Opportunity" class="oe_highlight" attrs="{'invisible': [('type', '=', 'opportunity')]}"/>
help="Convert to Opportunity" class="oe_highlight" attrs="{'invisible': ['|', ('type', '=', 'opportunity'), ('active', '=', False)]}"/>
<button name="toggle_active"
string="Restore"
type="object"
@@ -69,11 +78,11 @@
<group>
<group>
<!-- Preload all the partner's information -->
<field name="partner_id" string="Customer"
<field name="partner_id"
widget="res_partner_many2one"
context="{'default_name': contact_name, 'default_street': street, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_function': function, 'default_phone': phone, 'default_mobile': mobile, 'default_email': email_from, 'default_user_id': user_id, 'default_team_id': team_id, 'default_website': website, 'show_vat': True}"
groups="base.group_no_one"/>
<field name="partner_name" string="Company Name"/>
<field name="partner_name"/>
<label for="street" string="Address"/>
<div class="o_address_format">
<field name="street" placeholder="Street..." class="o_address_street"/>
@@ -120,9 +129,9 @@
<page name="extra" string="Extra Info">
<group>
<group string="Email">
<field name="message_bounce" readonly="1" groups="base.group_no_one"/>
<field name="message_bounce" readonly="1"/>
</group>
<group string="Tracking" groups="base.group_multi_company,base.group_no_one" name="categorization">
<group string="Tracking" groups="base.group_multi_company" name="categorization">
<field name="company_id"
groups="base.group_multi_company"
options="{'no_create': True}"/>
@@ -131,7 +140,7 @@
<field name="source_id"/>
<field name="referred"/>
</group>
<group string="Analysis" groups="base.group_no_one">
<group string="Analysis">
<field name="date_open"/>
<field name="date_closed"/>
<field name="probability"/>
@@ -492,10 +501,10 @@
<h2 class="o_row row no-gutters d-flex">
<div class="col">
<label for="planned_revenue" class="oe_edit_only" />
<div class="o_row">
<div>
<field name="company_currency" invisible="1"/>
<field name="planned_revenue" class="oe_inline" widget='monetary' options="{'currency_field': 'company_currency'}"/>
<span class="oe_grey"> at </span>
<span class="oe_grey p-2"> at </span>
</div>
</div>
<div class="col">
@@ -552,6 +561,8 @@
<group>
<field name="date_deadline"/>
<field name="priority" widget="priority"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
</group>
<group>
@@ -559,8 +570,6 @@
<field name="team_id" widget="selection"/>
</group>
<group>
<field name="priority" widget="priority"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
<field name="lost_reason" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="date_conversion" invisible="1"/>
</group>
@@ -568,11 +577,11 @@
<notebook colspan="4">
<page string="Internal Notes">
<field name="description"/>
<field name="description" placeholder="Add a description..."/>
</page>
<page name="lead" string="Followup">
<group>
<group string="Initial Contact Information">
<group string="Contact Information">
<field name="partner_name"/>
<label for="street" string="Address"/>
<div class="o_address_format">
@@ -778,10 +787,19 @@
<field name="arch" type="xml">
<form string="Channel">
<sheet>
<group>
<field name="name"/>
<field name="active"/>
</group>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
</button>
</div>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name"/>
</h1>
</div>
</sheet>
</form>
</field>
@@ -1108,9 +1126,9 @@ for rec in records:
<field name="view_id" ref="crm_lead_tag_tree"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new tag for your opportunities
Create new tags for your opportunities
</p><p>
Create tags that fit your business (product structure, sales type, etc.) to better manage and tack your opportunities.
Create tags that fit your business (product structure, sales type, etc.) to better manage and track your opportunities.
</p>
</field>
</record>
+13 -6
View File
@@ -34,17 +34,24 @@
<field name="arch" type="xml">
<form string="Stage">
<sheet>
<group>
<field name="team_count" invisible="1"/>
<group>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name"/>
<field name="team_id" options='{"no_open": True, "no_create": True}' attrs="{'invisible': [('team_count', '&lt;=', 1)]}"/>
<field name="fold"/>
</group>
</h1>
</div>
<group>
<group>
<field name="on_change"/>
<field name="probability" attrs="{'invisible': [('on_change', '=', False)]}"/>
</group>
<field name="team_count" invisible="1"/>
<group>
<field name="fold"/>
<field name="team_id" options='{"no_open": True, "no_create": True}' attrs="{'invisible': [('team_count', '&lt;=', 1)]}"/>
</group>
</group>
<separator string="Requirements"/>
<field name="requirements" nolabel="1" placeholder="Give your team the requirements to move an opportunity to this stage."/>
+2 -1
View File
@@ -97,7 +97,7 @@
<xpath expr="//field[@name='user_id']" position="after">
<label for="alias_name" string="Email Alias"
attrs="{'invisible': [('use_leads', '=', False), ('use_opportunities', '=', False)]}"/>
<div name="alias_def"
<div class="oe_inline" name="alias_def"
attrs="{'invisible': [('use_leads', '=', False), ('use_opportunities', '=', False)]}">
<field name="alias_id" class="oe_read_only oe_inline"
string="Email Alias" required="0"/>
@@ -109,6 +109,7 @@
groups="base.group_no_one"
string="Accept Emails From"
attrs="{'invisible': [('use_leads', '=', False), ('use_opportunities', '=', False)]}"/>
<field name="alias_user_id" string="Assign to"/>
</xpath>
<field name="dashboard_graph_period" position="attributes">
<attribute name="attrs">{'invisible': [('dashboard_graph_model', '=', 'crm.lead')]}</attribute>
@@ -61,7 +61,7 @@
<div class="o_setting_right_pane crm_reveal_settings">
<label string="Website Lead Generation" for="module_crm_reveal"/>
<div class="text-muted">
Convert visitors of your website into leads in the CRM. We do data enrichment based on their IP address.
Convert visitors of your website into leads and perform data enrichment based on their IP address.
</div>
</div>
</div>