[ADD] show avtars of members in sales team kanban if only crm is installed.

bzr revid: tpa@tinyerp.com-20131101090222-f0ewbmvc4kc2vqap
This commit is contained in:
Turkesh Patel (Open ERP)
2013-11-01 14:32:22 +05:30
parent 72ffc9a842
commit 05266e0a0f
4 changed files with 45 additions and 5 deletions
+5
View File
@@ -151,6 +151,11 @@
<a name="%(action_report_crm_opportunity_salesteam)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar" options="{'height': '20px', 'barWidth': '4', 'barSpacing': '1', 'delayIn': '3000', 'tooltip_suffix_field': 'currency_symbol'}">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a>
</div>
</div>
<div class="oe_kanban_salesteams_avatars">
<t t-foreach="record.member_ids.raw_value.slice(0,10)" t-as="member">
<img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/>
</t>
</div>
</div>
</div>
</t>
+3 -4
View File
@@ -2,12 +2,11 @@
width: 345px;
cursor: default;
}
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars {
text-align: right;
margin: -5px 0 -10px 0;
.openerp .oe_kanban_view .oe_kanban_salesteams_avatars {
margin-top: 20px;
}
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars img {
.openerp .oe_kanban_view .oe_kanban_salesteams_avatars img {
width: 30px;
height: 30px;
padding-left: 0px;
@@ -1,4 +1,40 @@
openerp.crm = function(openerp) {
openerp.web_kanban.KanbanView.include({
crm_display_members_names: function() {
/*
* Set avatar title for members.
* In kanban views, many2many fields only return a list of ids.
* We can implement return value of m2m fields like [(1,"Adminstration"),...].
*/
var self = this;
var members_ids = [];
// Collect members ids
self.$el.find('img[data-member_id]').each(function() {
members_ids.push($(this).data('member_id'));
});
// Find their matching names
var dataset = new openerp.web.DataSetSearch(self, 'res.users', self.session.context, [['id', 'in', _.uniq(members_ids)]]);
dataset.read_slice(['id', 'name']).done(function(result) {
_.each(result, function(v, k) {
// Set the proper value in the DOM
self.$el.find('img[data-member_id=' + v.id + ']').attr('title', v.name).tipsy({
offset: 10
});
});
});
},
on_groups_started: function() {
var self = this;
self._super.apply(self, arguments);
if (self.dataset.model === 'crm.case.section') {
self.crm_display_members_names();
}
},
});
openerp.web_kanban.KanbanRecord.include({
on_card_clicked: function() {
if (this.view.dataset.model === 'crm.case.section') {
+1 -1
View File
@@ -297,7 +297,7 @@
</a>
</div>
</xpath>
<xpath expr="//div[@class='oe_items_list']" position="after">
<xpath expr="//div[@class='oe_kanban_salesteams_avatars']" position="replace">
<div class="oe_center oe_salesteams_justgage" t-if="record.invoiced_target.raw_value">
<field name="monthly_invoiced" widget="gauge" style="width:160px; height: 120px;" 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', 'action_change': 'action_forecast'}">Forecast</field>