[IMP] salesteams: crm_case_section kanban sparkline with html tooltip
authorChristophe Matthieu <chm@openerp.com>
Thu, 18 Apr 2013 09:17:59 +0000 (11:17 +0200)
committerChristophe Matthieu <chm@openerp.com>
Thu, 18 Apr 2013 09:17:59 +0000 (11:17 +0200)
bzr revid: chm@openerp.com-20130418091759-7q02xo1p4pqauowa

addons/crm/crm.py
addons/crm/crm_case_section_view.xml
addons/crm/static/src/css/crm.css
addons/crm/static/src/js/crm_case_section.js
addons/sale_crm/sale_crm_view.xml

index d6cea46..9a1c285 100644 (file)
@@ -199,7 +199,6 @@ class crm_case_section(osv.osv):
 
         'open_lead_per_duration': fields.function(_get_open_lead_per_duration, string='Open Leads per duration', type="string", readonly=True),
         'won_opportunity_per_duration': fields.function(_get_won_opportunity_per_duration, string='Rate of opporunities whon per duration', type="string", readonly=True)
-        
     }
 
     def _get_stage_common(self, cr, uid, context):
index c32ce4e..183eece 100644 (file)
                                     <div class="oe_items_list">
                                         <div>
                                             <a t-if="record.use_leads.raw_value" name="%(crm_case_form_view_salesteams_lead)d" type="action">Leads</a>
-                                            <a name="%(crm_case_form_view_salesteams_lead)d" type="action" class="oe_sparkline_bar" title="Number of opening leads per duration.\n(last item is the most recent)"><t t-raw="record.open_lead_per_duration.raw_value"/></a>
+                                            <a name="%(action_report_crm_lead)d" type="action" class="oe_sparkline_bar" t-att-data-value="record.open_lead_per_duration.raw_value">Number of opening leads per duration.<br/>(last one is <t t-esc="record.target_duration_txt.raw_value"/>)</a>
                                         </div>
                                         <div>
                                             <a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Opportunities</a>
-                                            <a name="%(crm_case_form_view_salesteams_opportunity)d" type="action" class="oe_sparkline_bar" title="Rate of won opportunities per duration.\n(last item is the most recent)"><t t-raw="record.won_opportunity_per_duration.raw_value"/></a>
+                                            <a name="%(action_report_crm_opportunity)d" type="action" class="oe_sparkline_bar" t-att-data-value="record.won_opportunity_per_duration.raw_value">Rate of won opportunities per duration.<br/>(last one is <t t-esc="record.target_duration_txt.raw_value"/>)</a>
                                         </div>
                                     </div>
                                 </div>
index a64dd76..128f3da 100644 (file)
@@ -64,4 +64,5 @@
 
 .openerp .oe_kanban_view .oe_sparkline_bar {
     float: right;
+    height: 20px;
 }
\ No newline at end of file
index a228d09..fd30788 100644 (file)
@@ -61,7 +61,14 @@ openerp.crm = function(openerp) {
                             });
                         }
                     });
-                    setTimeout(function () {self.$(".oe_sparkline_bar").sparkline('html', {type: 'bar', barWidth: 5} );}, 0);
+                    setTimeout(function () {
+                        self.$(".oe_sparkline_bar").each(function () {
+                            var $el = $(this);
+                            $el.data("title", $el.html());
+                            $el.sparkline($el.data("value").split(','), {type: 'bar', barWidth: 5} );
+                            $el.tipsy({'delayIn': 0, 'html': true, 'title': function(){return $(this).data("title")}, 'gravity': 'n'});
+                        });
+                    }, 0);
                 });
             }
         },
index f3453dd..961ac05 100644 (file)
             <field name="arch" type="xml">
             <data>
                 <xpath expr="//field[@name='name']" position="after">
+
+
                     <field name="quotation_ids"/>
                     <field name="sale_order_ids"/>
                     <field name="invoice_ids"/>
+
+
                     <field name="sum_duration_invoice"/>
                     <field name="forcasted"/>
                     <field name="target_invoice"/>
                 </xpath>
                 <xpath expr="//div[@class='oe_items_list']" position="inside">
                     <div>
-                        <a name="%(action_quotations_salesteams)d" type="action"><t t-raw="record.quotation_ids.raw_value.length"/><t t-if="record.quotation_ids.raw_value.length &gt;= 2">Quotations</t><t t-if="record.quotation_ids.raw_value.length &lt; 2">Quotation</t></a>
-                        <a name="%(action_quotations_salesteams)d" type="action" class="oe_sparkline_bar"><t t-raw="[6,4,7,2,1]"/></a>
+                        <a name="%(action_quotations_salesteams)d" type="action">Quotations</a>
+                        <a name="%(action_quotations_salesteams)d" type="action" class="oe_sparkline_bar" data-value="6,4,7,2,6">jhfhgj</a>
                     </div>
                     <div>
-                        <a name="%(action_orders_salesteams)d" type="action"><t t-raw="record.sale_order_ids.raw_value.length"/><t t-if="record.sale_order_ids.raw_value.length &gt;= 2">Sales Orders</t><t t-if="record.sale_order_ids.raw_value.length &lt; 2">Sales Order</t>
-                        </a>
-                        <a name="%(action_orders_salesteams)d" type="action" class="oe_sparkline_bar"><t t-raw="[6,4,7,4,2]"/></a>
+                        <a name="%(action_orders_salesteams)d" type="action">Sales Orders</a>
+                        <a name="%(action_orders_salesteams)d" type="action" class="oe_sparkline_bar" data-value="6,4,7,2,6">jfhjh</a>
                     </div>
                     <div>
-                        <a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice"><t t-raw="record.invoice_ids.raw_value.length"/><t t-if="record.invoice_ids.raw_value.length &gt;= 2">Invoices</t><t t-if="record.invoice_ids.raw_value.length &lt; 2">Invoice</t></a>
-                        <a name="%(action_invoice_salesteams)d" type="action" class="oe_sparkline_bar"><t t-raw="[6,4,7,2,6]"/></a>
+                        <a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice">Invoices</a>
+                        <a name="%(action_invoice_salesteams)d" type="action" class="oe_sparkline_bar" data-value="6,4,7,2,6">jfghjgh</a>
                     </div>
                 </xpath>
                 <xpath expr="//div[@class='oe_items_list']" position="after">