[ADD] sales_team, sale, crm: new dashboard view for sales_team

This commit is contained in:
Martin Geubelle
2015-05-12 18:00:08 +02:00
parent aa29ba226a
commit edd7e9b687
11 changed files with 265 additions and 122 deletions
+1
View File
@@ -98,6 +98,7 @@ Dashboard for CRM will include:
'sales_team_view.xml',
'views/crm.xml',
'web_planner_data.xml',
'sales_team_dashboard.xml',
],
'demo': [
'crm_demo.xml',
+80
View File
@@ -0,0 +1,80 @@
<odoo>
<record id="action_opportunity_form" model="ir.actions.act_window">
<field name="name">New Opportunity</field>
<field name="res_model">crm.lead</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="domain">[('type','=','opportunity')]</field>
<field name="context">{
'search_default_team_id': [active_id],
'default_team_id': active_id,
'stage_type': 'opportunity',
'default_type': 'opportunity',
'default_user_id': uid,
}
</field>
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
</record>
<record model="ir.ui.view" id="crm_team_salesteams_view_kanban">
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
<field name="arch" type="xml">
<data>
<xpath expr="//templates" position="before">
<field name="alias_id"/>
<field name="alias_name"/>
<field name="alias_domain"/>
<field name="use_leads"/>
<field name="use_opportunities"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_primary')]" position="after">
<div t-if="record.use_leads.raw_value and record.alias_name.value and record.alias_domain.value">
<small><i class="fa fa-envelope-o"></i> <field name="alias_id"/></small>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_left')]" position="inside">
<button class="btn btn-primary" name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Pipeline</button>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="inside">
<div t-if="record.use_leads.raw_value">
<a name="%(crm_case_form_view_salesteams_lead)d" type="action">
Leads
</a>
</div>
<div t-if="record.use_opportunities.raw_value">
<a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">
Opportunities
</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<div>
<a name="%(action_opportunity_form)d" type="action">
Opportunity
</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<div>
<a name="%(action_report_crm_lead_salesteam)d" type="action">
Leads
</a>
</div>
<div>
<a name="%(action_report_crm_opportunity_salesteam)d" type="action">
Opportunities
</a>
</div>
</xpath>
</data>
</field>
</record>
</odoo>
-36
View File
@@ -79,42 +79,6 @@
<field name="help">Opportunities Analysis gives you an instant access to your opportunities with information such as the expected revenue, planned cost, missed deadlines or the number of interactions per opportunity. This report is mainly used by the sales manager in order to do the periodic review with the teams of the sales pipeline.</field>
</record>
<record model="ir.ui.view" id="crm_team_salesteams_view_kanban">
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
<field name="arch" type="xml">
<data>
<xpath expr="//templates" position="before">
<field name="alias_id"/>
<field name="alias_name"/>
<field name="alias_domain"/>
<field name="use_leads"/>
<field name="use_opportunities"/>
</xpath>
<xpath expr="//h4[@name='name']" position="after">
<div class="oe_kanban_alias text-center" t-if="record.use_leads.raw_value and record.alias_name.value and record.alias_domain.value">
<small><i class="fa fa-envelope-o"></i> <field name="alias_id"/></small>
</div>
</xpath>
<xpath expr="//span[@name='oe_salesteam_separator']" position="before">
<div class="col-md-6 oe_margin_top_4" t-if="record.use_leads.raw_value">
<div class="row">
<a class="col-md-9" name="%(crm_case_form_view_salesteams_lead)d" type="action">Leads</a>
<a class="col-md-3" name="%(action_report_crm_lead_salesteam)d" type="action"><i class="fa fa-bar-chart fa-fw"/></a>
</div>
</div>
<div class="col-md-6 oe_margin_top_4" t-if="record.use_opportunities.raw_value">
<div class="row">
<a class="col-md-9" name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Opportunities</a>
<a class="col-md-3" name="%(action_report_crm_opportunity_salesteam)d" type="action"><i class="fa fa-bar-chart fa-fw"/></a>
</div>
</div>
</xpath>
</data>
</field>
</record>
<record model="ir.ui.view" id="sales_team_form_view_in_crm">
<field name="name">crm.team.form</field>
<field name="model">crm.team</field>
+1
View File
@@ -77,6 +77,7 @@ The Dashboard for the Sales Manager will include
'res_config_view.xml',
'views/report_saleorder.xml',
'views/sale.xml',
'sales_team_dashboard.xml',
],
'demo': ['sale_demo.xml'],
'test': [
+16
View File
@@ -27,6 +27,19 @@ class crm_team(osv.Model):
res[id] = json.dumps(values)
return res
def _get_sales_to_invoice_amount(self, cr, uid, ids, field_name, arg, context=None):
obj = self.pool['sale.order']
res = dict.fromkeys(ids, 0)
domain = [
('team_id', 'in', ids),
('state', '=', 'manual'),
]
amounts = obj.read_group(cr, uid, domain, ['amount_total', 'team_id'], ['team_id'], context=context)
for rec in amounts:
res[rec['team_id'][0]] = rec['amount_total']
return res
_columns = {
'use_quotations': fields.boolean('Quotations', help="Check this box to manage quotations in this sales team."),
'invoiced_forecast': fields.integer(string='Invoice Forecast',
@@ -39,6 +52,9 @@ class crm_team(osv.Model):
'monthly_invoiced': fields.function(_get_invoices_data,
type='char', readonly=True,
string='Rate of sent invoices per duration'),
'sales_to_invoice_amount': fields.function(_get_sales_to_invoice_amount,
type='integer', readonly=True,
string='Amount of sales to invoice'),
}
_defaults = {
+96
View File
@@ -0,0 +1,96 @@
<odoo>
<record id="action_quotation_form" model="ir.actions.act_window">
<field name="name">New Quotation</field>
<field name="res_model">sale.order</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="context">{
'search_default_team_id': [active_id],
'default_team_id': active_id,
'default_user_id': uid,
}
</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
</record>
<record id="crm_team_salesteams_view_kanban" model="ir.ui.view">
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
<field name="arch" type="xml">
<data>
<xpath expr="//templates" position="before">
<field name="use_quotations"/>
<field name="monthly_invoiced"/>
<field name="invoiced_forecast"/>
<field name="invoiced_target"/>
<field name="sales_to_invoice_amount"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<div class="row">
<div class="col-xs-9">
<a name="%(action_orders_to_invoice_salesteams)d" type="action">
Sales to Invoice
</a>
</div>
<div class="col-xs-3">
<!-- TODO: use monetary widget when available on kanban view -->
<t t-esc="record.sales_to_invoice_amount.raw_value or 0"/>
</div>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="after">
<div class="col-xs-12 o_kanban_primary_bottom" t-if="record.invoiced_target.raw_value">
<!-- TODO: use progressbar widget when available on kanban view -->
<field name="invoiced_forecast" widget="progress" options="{'title': 'Forecast', 'current_value': 'invoiced_forecast', 'max_value': 'invoiced_target', 'editable': 'true', 'on_change': 'action_forecast'}"/>
</div>
<div t-if="!record.invoiced_target.raw_value" class="col-xs-12 o_kanban_primary_bottom">
Define an invoicing target in the sales team settings to see the period's achievement and forecast at a glance.
</div>
</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">
<a name="%(action_invoice_salesteams)d" type="action">Invoices</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<div>
<a name="%(action_quotation_form)d" type="action">
Quotation
</a>
</div>
</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>
<a name="%(action_account_invoice_report_salesteam)d" type="action">
Invoices
</a>
</div>
</xpath>
</data>
</field>
</record>
</odoo>
-48
View File
@@ -20,53 +20,5 @@
</field>
</record>
<record id="crm_team_salesteams_view_kanban" model="ir.ui.view">
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='name']" position="after">
<field name="use_quotations"/>
<field name="monthly_invoiced"/>
<field name="invoiced_forecast"/>
<field name="invoiced_target"/>
</xpath>
<xpath expr="//span[@name='oe_salesteam_separator']" position="after">
<div class="col-md-6 oe_margin_top_4" t-if="record.use_quotations.raw_value">
<div class="row">
<a class="col-md-9" name="%(action_quotations_salesteams)d" type="action">Quotations</a>
<a class="col-md-3" name="%(action_order_report_quotation_salesteam)d" type="action"><i class="fa fa-bar-chart fa-fw"/></a>
</div>
</div>
<div class="col-md-6 oe_margin_top_4">
<div class="row">
<a class="col-md-9" name="%(action_orders_salesteams)d" type="action">Sales Orders</a>
<a class="col-md-3" name="%(action_order_report_so_salesteam)d" type="action"><i class="fa fa-bar-chart fa-fw"/></a>
</div>
</div>
<div class="col-md-6 oe_margin_top_4" groups="account.group_account_invoice">
<div class="row">
<a class="col-md-9" name="%(action_invoice_salesteams)d" type="action">Invoices</a>
<a class="col-md-3" name="%(action_account_invoice_report_salesteam)d" type="action"><i class="fa fa-bar-chart fa-fw"/></a>
</div>
</div>
</xpath>
<xpath expr="//div[@class='oe_clear']" position="inside">
<div class="oe_margin_top_8" t-if="record.invoiced_target.raw_value">
<field name="monthly_invoiced" widget="gauge" style="width:160px; height: 120px; cursor: pointer;"
options="{'max_field': 'invoiced_target'}">Invoiced</field>
<field name="invoiced_forecast" widget="gauge" style="width:160px; height: 120px; cursor: pointer;"
options="{'max_field': 'invoiced_target', 'on_change': 'action_forecast'}">Forecast</field>
</div>
</xpath>
<xpath expr="//div[@class='oe_clear']" position="after">
<div class="text-center" style="color:#bbbbbb; min-height:132px" t-if="!record.invoiced_target.raw_value">
<br/>Define an invoicing target in the sales team settings to see the period's achievement and forecast at a glance.
</div>
</xpath>
</data>
</field>
</record>
</data>
</openerp>
+3 -1
View File
@@ -34,7 +34,9 @@ Using this application you can manage Sales Team with CRM and/or Sales
'security/ir.model.access.csv',
'res_config_view.xml',
'sales_team_data.xml',
'sales_team.xml',],
'sales_team.xml',
'sales_team_dashboard.xml',
],
'demo': ['sales_team_demo.xml'],
'css': ['static/src/css/sales_team.css'],
'installable': True,
+1 -37
View File
@@ -6,43 +6,6 @@
icon="fa-credit-card"
groups="base.group_sale_salesman,base.group_sale_manager" sequence="6"/>
<!-- Case Teams Salesteams kanban view -->
<record id="crm_team_salesteams_view_kanban" model="ir.ui.view" >
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey">
<field name="name"/>
<field name="user_id"/>
<field name="member_ids"/>
<field name="note"/>
<field name="color"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_kanban_crm_salesteams">
<div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_sale_manager">
<i class="fa fa-bars fa-lg"/>
<ul class="oe_dropdown_menu">
<li t-if="widget.view.is_action_enabled('edit')"><a type="edit">Edit Sales Team</a></li>
<li t-if="widget.view.is_action_enabled('delete')"><a type="delete">Delete</a></li>
<li t-if="widget.view.is_action_enabled('edit')"><ul class="oe_kanban_colorpicker" data-field="color"/></li>
</ul>
</div>
<div class="oe_kanban_content">
<h4 class="text-center" name="name"><strong><field name="name"/></strong></h4>
<div class="oe_salesteam_kanban_view row oe_margin_top_16">
<span name="oe_salesteam_separator"/>
</div>
<div class="oe_clear"></div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- Cateamions Search view -->
<record id="crm_team_salesteams_search" model="ir.ui.view">
<field name="name">Case Teams - Search</field>
@@ -187,6 +150,7 @@
<template id="assets_backend" name="sales_team assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/sales_team/static/src/css/sales_team.css"/>
<link rel="stylesheet" href="/sales_team/static/src/less/sales_team_dashboard.less"/>
<script type="text/javascript" src="/sales_team/static/src/js/sales_team.js"></script>
</xpath>
</template>
@@ -0,0 +1,60 @@
<odoo>
<!-- Case Teams Salesteams dashboard view -->
<record id="crm_team_salesteams_view_kanban" model="ir.ui.view" >
<field name="name">crm.team.kanban</field>
<field name="model">crm.team</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey o_kanban_dashboard o_salesteam_kanban">
<field name="name"/>
<field name="user_id"/>
<field name="member_ids"/>
<field name="note"/>
<field name="color"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="#{kanban_color(record.color.raw_value)}">
<div class="o_kanban_card_header">
<div class="o_kanban_card_header_title">
<div class="o_primary"><field name="name"/></div>
</div>
<div class="o_kanban_manage_button_section">
<a class="o_kanban_manage_toogle_button">More <i class="fa fa-caret-down"/></a>
</div>
</div>
<div class="container o_kanban_card_content o_visible">
<div class="row">
<div class="col-xs-6 o_kanban_primary_left">
</div>
<div class="col-xs-6 o_kanban_primary_right">
</div>
</div>
</div><div class="container o_kanban_card_manage_pane o_invisible">
<div class="row">
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_view">
<div class="o_kanban_card_manage_title">
<span>View</span>
</div>
</div>
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_new">
<div class="o_kanban_card_manage_title">
<span>New</span>
</div>
</div>
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_reports">
<div class="o_kanban_card_manage_title">
<span>Reports</span>
</div>
</div>
</div>
<div t-if="widget.view.is_action_enabled('edit')" class="o_kanban_card_manage_settings row">
<a type="edit">Settings</a>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</odoo>
@@ -0,0 +1,7 @@
.o_salesteam_kanban {
.oe_kanban_record {
min-height: 200px !important;
min-width: 500px !important;
max-width: 600px !important;
}
}