[IMP] sale, sales_team, crm: usability improvements

- sales_team: remove field note, usability improvement in kanban and form views
- crm: in crm.stage remove default_case, sequence and legend_priority fields and remove default stage_ids + some fields in technical group
- sale: add field use_invoices on sales_team and display links in dashboard according to this new field
This commit is contained in:
Jay Patel
2015-07-13 17:44:19 +02:00
committed by Martin Geubelle
parent ae7776620f
commit 8bf6b530d2
17 changed files with 118 additions and 142 deletions
+1
View File
@@ -77,6 +77,7 @@ Dashboard for CRM will include:
'sales_team_dashboard.xml',
],
'demo': [
'data/crm_stage_demo.xml',
'crm_demo.xml',
'crm_lead_demo.xml',
'data/crm_action_demo.xml',
+1 -4
View File
@@ -27,11 +27,9 @@ class crm_stage(osv.Model):
'sequence': fields.integer('Sequence', help="Used to order stages. Lower is better."),
'probability': fields.float('Probability (%)', required=True, help="This percentage depicts the default/average probability of the Case for this stage to be a success"),
'on_change': fields.boolean('Change Probability Automatically', help="Setting this stage will change the probability automatically on the opportunity."),
'requirements': fields.text('Requirements'),
'requirements': fields.text('Requirements', help="Enter here the internal requirements for this stage (ex: Offer sent to customer). It will appear as a tooltip over the stage's name."),
'team_ids': fields.many2many('crm.team', 'crm_team_stage_rel', 'stage_id', 'team_id', string='Teams',
help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."),
'case_default': fields.boolean('Default to New Sales Team',
help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."),
'legend_priority': fields.text(
'Priority Management Explanation', translate=True,
help='Explanation text to help users using the star and priority mechanism on stages or issues that are in this stage.'),
@@ -48,5 +46,4 @@ class crm_stage(osv.Model):
'probability': 1.0,
'fold': False,
'type': 'both',
'case_default': True,
}
+4 -5
View File
@@ -88,7 +88,7 @@ class crm_lead(format_address, osv.osv):
order = "%s desc" % order
# retrieve team_id from the context and write the domain
# - ('id', 'in', 'ids'): add columns that should be present
# - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded
# - OR ('fold', '=', False): add default columns that are not folded
# - OR ('team_ids', '=', team_id), ('fold', '=', False) if team_id: add team columns that are not folded
search_domain = []
team_id = self.pool['crm.team']._resolve_team_id_from_context(cr, uid, context=context)
@@ -96,7 +96,7 @@ class crm_lead(format_address, osv.osv):
search_domain += ['|', ('team_ids', '=', team_id)]
search_domain += [('id', 'in', ids)]
else:
search_domain += ['|', ('id', 'in', ids), ('case_default', '=', True)]
search_domain += [('id', 'in', ids)]
# retrieve type from the context (if set: choose 'type' or 'both')
type = self._resolve_type_from_context(cr, uid, context=context)
if type:
@@ -324,13 +324,12 @@ class crm_lead(format_address, osv.osv):
team_ids.add(lead.team_id.id)
if lead.type not in types:
types.append(lead.type)
# OR all team_ids and OR with case_default
# OR all team_ids
search_domain = []
if team_ids:
search_domain += [('|')] * len(team_ids)
search_domain += [('|')] * (len(team_ids) - 1)
for team_id in team_ids:
search_domain.append(('team_ids', '=', team_id))
search_domain.append(('case_default', '=', True))
# AND with cases types
if not avoid_add_type_term:
search_domain.append(('type', 'in', types))
-68
View File
@@ -1,74 +1,6 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<!-- Crm stages -->
<record model="crm.stage" id="stage_lead1">
<field name="name">New</field>
<field name="case_default">1</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">1</field>
<field name="type">both</field>
</record>
<record model="crm.stage" id="stage_lead2">
<field name="name">Dead</field>
<field name="case_default">1</field>
<field name="fold">1</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">30</field>
<field name="type">lead</field>
</record>
<record model="crm.stage" id="stage_lead3">
<field name="name">Qualification</field>
<field name="case_default">1</field>
<field name="probability">20</field>
<field name="on_change">1</field>
<field name="sequence">40</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead4">
<field name="name">Proposition</field>
<field name="case_default">1</field>
<field name="probability">40</field>
<field name="on_change">1</field>
<field name="sequence">50</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead5">
<field name="name">Negotiation</field>
<field name="case_default">1</field>
<field name="probability">60</field>
<field name="on_change">1</field>
<field name="sequence">60</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead6">
<field name="name">Won</field>
<field name="case_default">1</field>
<field name="fold">1</field>
<field name="probability">100</field>
<field name="on_change">1</field>
<field name="sequence">70</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead7">
<field name="name">Lost</field>
<field name="case_default">1</field>
<field name="fold">1</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">80</field>
<field name="type">opportunity</field>
</record>
<record model="crm.team" id="sales_team.team_sales_department">
<field name="stage_ids" eval="[ (4, ref('stage_lead1')), (4, ref('stage_lead2')),
(4, ref('stage_lead3')), (4, ref('stage_lead4')),
(4, ref('stage_lead5')), (4, ref('stage_lead6')),
(4, ref('stage_lead7'))]"/>
</record>
<!-- crm categories -->
<record model="crm.lead.tag" id="categ_oppor1">
+1 -1
View File
@@ -107,7 +107,7 @@
<button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
help="Convert to Opportunity" class="oe_highlight"/>
<field name="stage_id" widget="statusbar" clickable="True"
domain="['&amp;', '|', ('case_default', '=', True), ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]"
domain="['&amp;', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]"
options="{'fold_field': 'fold'}"
on_change="onchange_stage_id(stage_id)"/>
</header>
+2 -5
View File
@@ -76,22 +76,19 @@
<group>
<group>
<field name="name"/>
<field name="sequence"/>
<field name="type"/>
<field name="on_change"/>
<label for="probability" attrs="{'invisible': [('on_change', '=', False)]}"/>
<div attrs="{'invisible': [('on_change', '=', False)]}">
<field name="probability"/>
<p class="text-muted">
A stage will be considered as 'Won' if the probability is 100% and if 'Change Probability Automatically' is true. The sequence should be greater than 1.<br/>
A stage will be considered as 'Lost' or 'Dead' if the probability is 0% and if 'Change Probability Automatically' is true. The sequence should be greater than 1.
A stage will be considered as 'Won' if the probability is 100% and if 'Change Probability Automatically' is true.<br/>
A stage will be considered as 'Lost' or 'Dead' if the probability is 0% and if 'Change Probability Automatically' is true.
</p>
</div>
<field name="case_default" groups="base.group_multi_salesteams"/>
</group>
<group>
<field name="fold"/>
<field name="legend_priority"/>
</group>
</group>
<separator string="Requirements"/>
+67
View File
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Crm stages -->
<record model="crm.stage" id="stage_lead1">
<field name="name">New</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">1</field>
<field name="type">both</field>
</record>
<record model="crm.stage" id="stage_lead2">
<field name="name">Dead</field>
<field name="fold">1</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">30</field>
<field name="type">lead</field>
</record>
<record model="crm.stage" id="stage_lead3">
<field name="name">Qualification</field>
<field name="probability">20</field>
<field name="on_change">1</field>
<field name="sequence">40</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead4">
<field name="name">Proposition</field>
<field name="probability">40</field>
<field name="on_change">1</field>
<field name="sequence">50</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead5">
<field name="name">Negotiation</field>
<field name="probability">60</field>
<field name="on_change">1</field>
<field name="sequence">60</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead6">
<field name="name">Won</field>
<field name="fold">1</field>
<field name="probability">100</field>
<field name="on_change">1</field>
<field name="sequence">70</field>
<field name="type">opportunity</field>
</record>
<record model="crm.stage" id="stage_lead7">
<field name="name">Lost</field>
<field name="fold">1</field>
<field name="probability">0</field>
<field name="on_change">1</field>
<field name="sequence">80</field>
<field name="type">opportunity</field>
</record>
<record model="crm.team" id="sales_team.team_sales_department">
<field name="stage_ids" eval="[ (4, ref('stage_lead1')), (4, ref('stage_lead2')),
(4, ref('stage_lead3')), (4, ref('stage_lead4')),
(4, ref('stage_lead5')), (4, ref('stage_lead6')),
(4, ref('stage_lead7'))]"/>
</record>
</data>
</odoo>
-5
View File
@@ -21,12 +21,7 @@ class crm_team(osv.Model):
return self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(crm_team, self)._auto_init,
'crm.lead', self._columns['alias_id'], 'name', alias_prefix='Lead+', alias_defaults={}, context=context)
def _get_stage_common(self, cr, uid, context):
ids = self.pool.get('crm.stage').search(cr, uid, [('case_default', '=', 1)], context=context)
return ids
_defaults = {
'stage_ids': _get_stage_common,
'use_leads': True,
'use_opportunities': True,
}
+2 -2
View File
@@ -89,12 +89,12 @@
<field name="use_opportunities" class="oe_inline"/><label for="use_opportunities"/>
</xpath>
<xpath expr="//page[@name='members']" position="after">
<page string="Stages">
<page string="Stages" groups="base.group_no_one">
<separator string="Select Stages for this Sales Team"/>
<field name="stage_ids"/>
</page>
</xpath>
<xpath expr="//field[@name='active']" position="before">
<xpath expr="//group[@name='sales_team_more_info']" position="inside">
<group name="alias_info" string="Leads Email Alias" class="oe_inline" attrs="{'invisible': [('alias_domain', '=', False)]}">
<label for="alias_name" string="Email Alias"
attrs="{'invisible': [('alias_domain', '=', False)]}"/>
-13
View File
@@ -38,19 +38,6 @@
-
!python {model: crm.lead}: |
self.message_post(cr, uid, [ref('crm_case_3')], subject='Test note', body='Détails envoyés par le client sur ​​le FAX pour la qualité')
-
I win this opportunity
-
!python {model: crm.lead}: |
self.case_mark_won(cr, uid, [ref("crm_case_3")])
-
I check details of the opportunity after having won the opportunity.
-
!python {model: crm.lead}: |
lead = self.browse(cr, uid, ref('crm_case_3'))
assert lead.stage_id.id == ref('crm.stage_lead6'), "Opportunity stage should be 'Won'."
assert lead.stage_id.probability == 100.0, "Opportunity is not 'done'"
assert lead.probability == 100.0, "Revenue probability should be 100.0!"
-
I convert mass lead into opportunity customer.
-
@@ -3,14 +3,12 @@
<data>
<record model="crm.stage" id="stage_portal_lead_assigned">
<field name="name">Assigned</field>
<field eval="1" name="case_default"/>
<field eval="10" name="probability"/>
<field eval="12" name="sequence"/>
<field name="type">lead</field>
</record>
<record model="crm.stage" id="stage_portal_lead_recycle">
<field name="name">To Recycle</field>
<field eval="1" name="case_default"/>
<field eval="5" name="probability"/>
<field eval="11" name="sequence"/>
<field name="type">lead</field>
+5 -4
View File
@@ -27,12 +27,13 @@ class crm_team(osv.Model):
_columns = {
'use_quotations': fields.boolean('Quotations', help="Check this box to manage quotations in this sales team."),
'use_invoices': fields.boolean('Invoices', help="Check this box to manage invoices in this sales team."),
'invoiced_forecast': fields.integer(string='Invoice Forecast',
help="Forecast of the invoice revenue for the current month. This is the amount the sales \n"
"team should invoice this month. It is used to compute the progression ratio \n"
" of the current and forecast revenue on the kanban view."),
help="Forecast of the invoice revenue for the current month. This is the amount the sales "
"team should invoice this month. It is used to compute the progression ratio "
"of the current and forecast revenue on the kanban view."),
'invoiced_target': fields.integer(string='Invoice Target',
help="Target of invoice revenue for the current month. This is the amount the sales \n"
help="Target of invoice revenue for the current month. This is the amount the sales "
"team estimates to be able to invoice this month."),
'sales_to_invoice_amount': fields.function(_get_sales_to_invoice_amount,
type='integer', readonly=True,
+24 -19
View File
@@ -22,6 +22,7 @@
<data>
<xpath expr="//templates" position="before">
<field name="use_quotations"/>
<field name="use_invoices"/>
<field name="invoiced_forecast"/>
<field name="invoiced_target"/>
<field name="sales_to_invoice_amount"/>
@@ -51,19 +52,21 @@
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="inside">
<div t-if="record.use_quotations.raw_value">
<a name="%(action_quotations_salesteams)d" type="action">Quotations</a>
</div>
<div >
<a name="%(action_orders_salesteams)d" type="action">Sales Orders</a>
</div>
<div groups="account.group_account_invoice">
<t t-if="record.use_quotations.raw_value">
<div>
<a name="%(action_quotations_salesteams)d" type="action">Quotations</a>
</div>
<div >
<a name="%(action_orders_salesteams)d" type="action">Sales Orders</a>
</div>
</t>
<div t-if="record.use_invoices.raw_value" groups="account.group_account_invoice">
<a name="%(action_invoice_salesteams)d" type="action">Invoices</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<div>
<div t-if="record.use_quotations.raw_value">
<a name="%(action_quotation_form)d" type="action">
Quotation
</a>
@@ -71,17 +74,19 @@
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<div>
<a name="%(action_order_report_quotation_salesteam)d" type="action">
Quotation
</a>
</div>
<div>
<a name="%(action_order_report_so_salesteam)d" type="action">
Sales
</a>
</div>
<div>
<t t-if="record.use_quotations.raw_value">
<div>
<a name="%(action_order_report_quotation_salesteam)d" type="action">
Quotation
</a>
</div>
<div>
<a name="%(action_order_report_so_salesteam)d" type="action">
Sales
</a>
</div>
</t>
<div t-if="record.use_invoices.raw_value">
<a name="%(action_account_invoice_report_salesteam)d" type="action">
Invoices
</a>
+4 -2
View File
@@ -9,9 +9,11 @@
<data>
<xpath expr="//div[@name='options_active']" position="inside">
<field name="use_quotations" class="oe_inline"/><label for="use_quotations"/>
<field name="use_invoices" class="oe_inline" groups="account.group_account_invoice"/>
<label for="use_invoices" groups="account.group_account_invoice"/>
</xpath>
<xpath expr="//group[@name='sales_team_more_info']" position="after">
<group string="Invoicing">
<xpath expr="//group[@name='sales_team_more_info']" position="inside">
<group string="Invoicing/Progression Ratio">
<field name="invoiced_target"/>
<field name="invoiced_forecast"/>
</group>
-1
View File
@@ -50,7 +50,6 @@ class crm_team(osv.Model):
'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by Odoo about cases in this sales team"),
'parent_id': fields.many2one('crm.team', 'Parent Team'),
'child_ids': fields.one2many('crm.team', 'parent_id', 'Child Teams'),
'note': fields.text('Description'),
'working_hours': fields.float('Working Hours', digits=(16, 2)),
'color': fields.integer('Color Index'),
}
+7 -10
View File
@@ -16,7 +16,6 @@
<field name="name"/>
<field name="parent_id"/>
<field name="user_id"/>
<field name="note"/>
<field name="code"/>
<group expand="0" string="Group By...">
<filter string="Team Leader" domain="[]" context="{'group_by':'user_id'}"/>
@@ -64,7 +63,6 @@
<group name="left">
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
<field name="code" groups="base.group_no_one"/>
<field name="active"/>
</group>
<group name="right">
</group>
@@ -90,16 +88,15 @@
</kanban>
</field>
</page>
<page string="More Info" groups="base.group_sale_manager">
<group name="sales_team_more_info">
<page string="More Info" groups="base.group_no_one">
<group>
<field name="active"/>
<group string="Company" groups="base.group_multi_company">
<field name="company_id"
options="{'no_create': True}"/>
<field name="company_id" options="{'no_create': True}"/>
</group>
</group>
</page>
<page string="Notes">
<field name="note"/>
</group>
<group name="sales_team_more_info">
</group>
</page>
</notebook>
</sheet>
@@ -8,7 +8,6 @@
<field name="name"/>
<field name="user_id"/>
<field name="member_ids"/>
<field name="note"/>
<field name="color"/>
<templates>
<t t-name="kanban-box">