[IMP] improved code to show bar required help and with delay

bzr revid: tpa@tinyerp.com-20130916130700-e9ipoezcjeyva3mb
This commit is contained in:
Turkesh Patel (Open ERP)
2013-09-16 18:37:00 +05:30
parent a2b6b5df02
commit da358b54ab
3 changed files with 17 additions and 30 deletions
+2 -2
View File
@@ -144,11 +144,11 @@
<div class="oe_items_list">
<div class="oe_salesteams_leads" t-if="record.use_leads.raw_value">
<a name="%(crm_case_form_view_salesteams_lead)d" type="action">Leads</a>
<a name="%(action_report_crm_lead_salesteam)d" type="action" class="oe_sparkline_bar_link"><field name="monthly_open_leads" widget="sparkline_bar" options="{'height': '20px', 'barWidth': 4, 'barSpacing': 1}">Open Leads per Month<br/>Click to see a detailed analysis of leads.</field></a>
<a name="%(action_report_crm_lead_salesteam)d" type="action" class="oe_sparkline_bar_link"><field name="monthly_open_leads" widget="sparkline_bar_sales" options="{'height': '20px', 'barWidth': 4, 'barSpacing': 1, 'delayIn': '3000'}">Open Leads per Month<br/>Click to see a detailed analysis of leads.</field></a>
</div>
<div class="oe_salesteams_opportunities">
<a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Opportunities</a>
<a name="%(action_report_crm_opportunity_salesteam)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar" height="20px" barWidth="4" barSpacing="1">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a>
<a name="%(action_report_crm_opportunity_salesteam)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar_sales" options="{'height': '20px', 'barWidth': '4', 'barSpacing': '1', 'delayIn': '3000'}">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a>
</div>
</div>
</div>
+12 -25
View File
@@ -9,30 +9,17 @@ var _t = openerp.web._t;
}
},
});
openerp.crm.SparklineBarWidget = openerp.web_kanban.AbstractField.extend({
className: "oe_sparkline_bar",
start: function() {
var self = this;
var title = this.$node.html();
setTimeout(function () {
var value = _.pluck(self.field.value, 'value');
var tooltips = _.pluck(self.field.value, 'tooltip');
var currency_symbol = "";
if (self.getParent()){
currency_symbol = self.getParent().record.currency_symbol.raw_value;
};
self.$el.sparkline(value, {
type: 'bar',
barWidth: 5,
tooltipFormat: _.str.sprintf("{{offset:offset}}: {{value}} %s",self.$el.closest("div[class='oe_salesteams_leads']").attr('class') ? _t('Lead(s)') : currency_symbol),
tooltipValueLookups: {
'offset': tooltips
},
});
self.$el.tipsy({'delayIn': 3000, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
}, 0);
},
});
openerp.web_kanban.fields_registry.add("sparkline_bar", "openerp.crm.SparklineBarWidget");
openerp.web_kanban.SparklineBarWidgetSalesTeam = openerp.web_kanban.SparklineBarWidget.extend({
set_offset:function(){
var self = this;
var currency_symbol = "";
if (self.getParent()){
currency_symbol = self.getParent().record.currency_symbol.raw_value;
};
return _.str.sprintf("{{offset:offset}}: {{value}} %s",self.$el.closest("div[class='oe_salesteams_leads']").attr('class') ? _t('Lead(s)') : currency_symbol)
}
});
openerp.web_kanban.fields_registry.add("sparkline_bar_sales", "openerp.web_kanban.SparklineBarWidgetSalesTeam");
};
+3 -3
View File
@@ -272,7 +272,7 @@
<div class="oe_salesteams_orders">
<a name="%(action_orders_salesteams)d" type="action">Sales Orders</a>
<a name="%(action_order_report_so_salesteam)d" type="action" class="oe_sparkline_bar_link">
<field name="monthly_confirmed" widget="sparkline_bar">
<field name="monthly_confirmed" widget="sparkline_bar_sales" options="{'delayIn': '3000'}">
Revenue of confirmed sales orders per month.<br/>Click to acces the Sales Analysis.
</field>
</a>
@@ -282,7 +282,7 @@
<div class="oe_salesteams_invoices">
<a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice">Invoices</a>
<a name="%(action_account_invoice_report_salesteam)d" type="action" class="oe_sparkline_bar_link">
<field name="monthly_invoiced" widget="sparkline_bar">
<field name="monthly_invoiced" widget="sparkline_bar_sales" options="{'delayIn': '3000'}">
Revenue of sent invoices per month.<br/>Click to see a detailed analysis of invoices.
</field>
</a>
@@ -290,7 +290,7 @@
<div class="oe_salesteams_quotations">
<a name="%(action_quotations_salesteams)d" type="action" class="oe_sparkline_bar_link">Quotations</a>
<a name="%(action_order_report_quotation_salesteam)d" type="action" class="oe_sparkline_bar_link">
<field name="monthly_quoted" widget="sparkline_bar">
<field name="monthly_quoted" widget="sparkline_bar_sales" options="{'delayIn': '3000'}">
Revenue of created quotations per month.<br/>Click to see a detailed analysis.
</field>
</a>