[IMP] crm_case_section: add js libraries JustGage
bzr revid: chm@openerp.com-20130412161730-lrx5tqr6wn784glq
This commit is contained in:
parent
1fe0a9afe9
commit
84ac4daf19
|
@ -120,7 +120,9 @@ Dashboard for CRM will include:
|
|||
'static/src/css/crm.css'
|
||||
],
|
||||
'js': [
|
||||
'static/src/js/crm.js'
|
||||
'static/src/js/crm_case_section.js',
|
||||
'static/lib/sparkline/jquery.sparkline.min.js',
|
||||
'static/lib/justgage.js',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<field name="open_opportunity_ids"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_project oe_kanban_global_click oe_kanban_crm_salesteams">
|
||||
<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_user">
|
||||
<span class="oe_e">í</span>
|
||||
<ul class="oe_dropdown_menu">
|
||||
|
@ -93,9 +93,9 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="oe_kanban_content">
|
||||
<h4><field name="name"/></h4>
|
||||
<div class="oe_kanban_alias" t-if="record.use_leads.raw_value and record.alias_id.value">
|
||||
<span class="oe_e">%%</span><small><field name="alias_id"/></small>
|
||||
<h4 class="oe_center"><field name="name"/></h4>
|
||||
<div class="oe_kanban_alias oe_center" t-if="record.use_leads.raw_value and record.alias_id.value">
|
||||
<small><span class="oe_e" style="float: none;">%%</span><t t-raw="record.alias_id.raw_value[1]"/></small>
|
||||
</div>
|
||||
<div class="oe_items_list">
|
||||
<a t-if="record.use_leads.raw_value" name="%(crm_case_form_view_salesteams_lead)d" type="action">
|
||||
|
@ -107,12 +107,12 @@
|
|||
<t t-if="record.open_opportunity_ids.raw_value.length >= 2">Opportunities</t>
|
||||
<t t-if="record.open_opportunity_ids.raw_value.length < 2">Opportunity</t></a>
|
||||
</div>
|
||||
<div class="oe_avatars">
|
||||
<!--div class="oe_avatars">
|
||||
<img t-if="record.user_id.raw_value" t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-data-member_id="record.user_id.raw_value"/>
|
||||
<t t-foreach="record.member_ids.raw_value.slice(0,11)" t-as="member">
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/>
|
||||
</t>
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -20,10 +20,10 @@
|
|||
}
|
||||
|
||||
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list {
|
||||
margin: 10px 0;
|
||||
margin: 10px;
|
||||
}
|
||||
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a {
|
||||
width: 110px;
|
||||
width: 160px;
|
||||
display: inline-block;
|
||||
}
|
||||
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a:hover {
|
||||
|
@ -40,3 +40,8 @@
|
|||
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_subsum {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.openerp .oe_kanban_view .oe_justgage {
|
||||
color: black;
|
||||
display: inline-block;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
openerp.crm = function(openerp) {
|
||||
openerp.web_kanban.KanbanRecord.include({
|
||||
on_card_clicked: function() {
|
||||
if (this.view.dataset.model === 'crm.case.section') {
|
||||
this.$('.oe_kanban_crm_salesteams_list a').first().click();
|
||||
} else {
|
||||
this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
|
@ -0,0 +1,70 @@
|
|||
openerp.crm = function(openerp) {
|
||||
openerp.web_kanban.KanbanRecord.include({
|
||||
renderElement: function () {
|
||||
var rendering = this._super();
|
||||
var self = this;
|
||||
|
||||
if (self.view.dataset.model === 'crm.case.section') {
|
||||
$.when(rendering).done(function() {
|
||||
self.$(".oe_justgage").each(function () {
|
||||
var $el = $(this);
|
||||
var title = $el.html();
|
||||
var unique_id = _.uniqueId("JustGage");
|
||||
$el.empty().css("position", "relative").attr('id', unique_id);
|
||||
|
||||
new JustGage({
|
||||
id: unique_id,
|
||||
node: this,
|
||||
title: title,
|
||||
value: +$el.data('value'),
|
||||
min: 0,
|
||||
max: +$el.data('max'),
|
||||
relativeGaugeSize: true,
|
||||
humanFriendly: true,
|
||||
label: $el.data('label'),
|
||||
levelColors: [
|
||||
"#ff0000",
|
||||
"#f9c802",
|
||||
"#a9d70b"
|
||||
],
|
||||
});
|
||||
|
||||
if ($el.data('action')) {
|
||||
$el.click(function (event) {
|
||||
event.stopPropagation();
|
||||
if (!$el.find(".oe_justgage_edit").size()) {
|
||||
var $svg = $el.find('svg');
|
||||
$div = $('<div class="oe_justgage_edit" style="z-index: 1; position: absolute; width: ' + $svg.width() + 'px; top: ' + ($svg.height()/2-5) + 'px;"/>');
|
||||
$input = $('<input style="text-align: center; width: ' + ($svg.width()-40) + 'px; margin: auto;"/>').val($el.data('value'));
|
||||
$div.append($input);
|
||||
$el.prepend($div)
|
||||
$input.focus();
|
||||
$input.keydown(function (event) {
|
||||
event.stopPropagation();
|
||||
if (event.keyCode == 13 || event.keyCode == 9) {
|
||||
if ($input.val() != $el.data('value')) {
|
||||
self.view.dataset.call($el.data('action'), [self.id, $input.val()]).then(function () {
|
||||
self.do_reload();
|
||||
});
|
||||
} else {
|
||||
$div.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
on_card_clicked: function() {
|
||||
if (this.view.dataset.model === 'crm.case.section') {
|
||||
this.$('.oe_kanban_crm_salesteams_list a').first().click();
|
||||
} else {
|
||||
this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
};
|
|
@ -34,7 +34,7 @@ with the effect of creating, editing and deleting either ways.
|
|||
'author': 'OpenERP SA',
|
||||
'website': 'http://www.openerp.com',
|
||||
'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'],
|
||||
'depends': ['project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'],
|
||||
'depends': ['resource', 'project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'security/project_timesheet_security.xml',
|
||||
|
|
|
@ -58,8 +58,11 @@ class crm_case_section(osv.osv):
|
|||
'sum_month_invoice': fields.function(_get_sum_month_invoice,
|
||||
string='Total invoiced this month',
|
||||
type='integer', readonly=True),
|
||||
'forcasted': fields.integer(string='Total forcasted for this month'),
|
||||
}
|
||||
|
||||
def action_forcasted(self, cr, uid, id, value, context=None):
|
||||
return self.write(cr, uid, [id], {'forcasted': value}, context=context)
|
||||
|
||||
class res_users(osv.Model):
|
||||
_inherit = 'res.users'
|
||||
|
|
|
@ -217,6 +217,8 @@
|
|||
<field name="quotation_ids"/>
|
||||
<field name="sale_order_ids"/>
|
||||
<field name="invoice_ids"/>
|
||||
<field name="sum_month_invoice"/>
|
||||
<field name="forcasted"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='oe_items_list']" position="inside">
|
||||
<a name="%(action_quotations_salesteams)d" type="action">
|
||||
|
@ -237,8 +239,8 @@
|
|||
</xpath>
|
||||
<xpath expr="//div[@class='oe_items_list']" position="after">
|
||||
<div class="oe_center">
|
||||
<div class="oe_sum"><field name="sum_month_invoice"/></div>
|
||||
<div class="oe_subsum">Invoiced this month</div>
|
||||
<div class="oe_justgage" style="width:160px; height: 120px;" t-att-data-value="record.sum_month_invoice.raw_value" t-att-data-max="25000" data-label="this month">Invoiced</div>
|
||||
<div class="oe_justgage" style="width:160px; height: 120px;" t-att-data-value="record.forcasted.raw_value" t-att-data-max="25000" data-label="this month" data-action="action_forcasted">Forcasted</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue