[IMP] use suffix in kanban and better view

bzr revid: mat@openerp.com-20130410153031-s6op7d7wyfdzrcti
This commit is contained in:
Martin Trigaux
2013-04-10 17:30:31 +02:00
parent ff12c44391
commit 1e9805fbfd
5 changed files with 46 additions and 17 deletions
+5 -6
View File
@@ -187,14 +187,13 @@ class gamification_goal(osv.Model):
help="In case of manual goal, reminders are sent if the goal as not been updated for a while (defined in goal plan). Ignored in case of non-manual goal or goal not linked to a plan."),
'type_description': fields.related('type_id','description',
type='char',
string='Type Description'),
type='char', string='Type Description'),
'type_unit': fields.related('type_id', 'unit',
type='char',
string='Type Description'),
type='char', string='Type Description'),
'type_condition': fields.related('type_id', 'condition',
type='char',
string='Type Condition'),
type='char', string='Type Condition'),
'type_suffix': fields.related('type_id', 'full_suffix',
type="char", string="Suffix"),
}
_defaults = {
+16 -3
View File
@@ -137,6 +137,9 @@
<field name="state"/>
<field name="target_goal"/>
<field name="type_condition"/>
<field name="type_suffix"/>
<field name="start_date"/>
<field name="end_date"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click oe_kanban_goal">
@@ -145,10 +148,20 @@
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" />
</div>
<h4 class="oe_goal_name"><field name="type_id"/></h4>
<t t-if="record.type_description.value">
<em><field name="type_description"/></em>
</t>
<div class="oe_goal_gauge"></div>
<p>
<t t-if="record.type_description.value">
<em><field name="type_description"/></em>
</t>
</p>
<p>
<t t-if="record.start_date.value">
From <t t-esc="record.start_date.value" />
</t>
<t t-if="record.end_date.value">
To <t t-esc="record.start_date.value" />
</t>
</p>
</div>
</div>
</t>
+10 -2
View File
@@ -2,7 +2,10 @@
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal,
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge {
width: 220px;
min-height: 150px;
min-height: 200px;
}
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal p {
text-align: center;
}
.oe_kanban_badge_avatars {
@@ -18,7 +21,12 @@
}
.oe_goal_gauge {
width:200px;
height:150px;
height:130px;
margin: auto;
margin-bottom: -30px;
}
.oe_goal_gauge svg {
margin-top: -30px;
}
@@ -38,8 +38,6 @@ openerp.gamification = function(instance) {
action_manager.do_action(goal_action.action).done(function () {
self.get_goal_todo_info();
});
//var form = action_manager.dialog_widget.views.form.controller;
});
}
},
@@ -132,13 +130,24 @@ openerp.gamification = function(instance) {
value: self.record.current.raw_value,
min: 0,
max: self.record.target_goal.raw_value,
// title: self.record.type_id.value,
relativeGaugeSize: true,
humanFriendly: true,
// add space between value and symbol
// textRenderer: function(value) {
// symbol = self.record.type_suffix.raw_value;
// humannbr = humanFriendlyNumber(value, 0)
// if ((humannbr + symbol).length > 6) {
// return humannbr;
// } else {
// return humannbr + " " + symbol;
// }
// },
label: self.record.type_suffix.raw_value,
levelColors: [
"#f9c802",
"#ff0000",
"#a9d70b"
]
],
});
}
});
@@ -615,10 +615,10 @@
} else if(obj.config.humanFriendly) {
obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol;
} else {
obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals);
obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol;
}
obj.txtValue.attr("text", obj.originalValue + obj.config.symbol);
obj.txtValue.attr("text", obj.originalValue);
setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY);
}