[IMP] hr_attendance: remove unuseful JS code + clean view

This commit is contained in:
Fabien Pinckaers
2016-11-28 09:55:05 +01:00
parent ec4c37229f
commit c468cfdd69
2 changed files with 22 additions and 35 deletions
@@ -27,26 +27,6 @@ var FormPresenceIndicator = form_common.AbstractField.extend({
},
});
var KanbanPresenceIndicator = kanban_widgets.AbstractField.extend({
init: function() {
this._super.apply(this, arguments);
},
start: function() {
this.display_field();
this.render_value(); // doesn't get called automatically in kanban_widgets.AbstractField
this.$el.tooltip({title: _t("employee presence<br/>green: checked in<br/>red: checked out"), trigger: 'hover'});
return this._super();
},
render_value: function() {
this.$('.oe_hr_attendance_status').toggleClass("oe_hr_attendance_status_green", this.field.raw_value == 'checked_in');
this.$('.oe_hr_attendance_status').toggleClass("oe_hr_attendance_status_red", this.field.raw_value == 'checked_out');
},
display_field: function() {
this.$el.html(QWeb.render("PresenceIndicator"));
},
});
core.form_widget_registry.add('hr_attendance_form_presence_indicator', FormPresenceIndicator);
kanban_widgets.registry.add('hr_attendance_kanban_presence_indicator', KanbanPresenceIndicator);
});
});
+21 -14
View File
@@ -28,6 +28,7 @@
<field name="priority">99</field>
<field name="arch" type="xml">
<kanban class="o_hr_employee_attendance_kanban" create="false">
<field name="attendance_state"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
@@ -36,13 +37,15 @@
</div>
<div class="oe_kanban_details">
<div id="textbox">
<div class="col-xs-11" style="padding:0px">
<strong>
<field name="name"/>
</strong>
</div><div class="col-xs-1" style="padding:0px">
<field name="attendance_state" widget="hr_attendance_kanban_presence_indicator"/>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span class="oe_kanban_status oe_kanban_status_green"></span>
</div>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span class="oe_kanban_status oe_kanban_status_red"></span>
</div>
<strong>
<field name="name"/>
</strong>
</div>
<ul>
<li t-if="record.job_id.raw_value"><field name="job_id"/></li>
@@ -62,16 +65,20 @@
<field name="inherit_id" ref="hr.hr_kanban_view_employees"/>
<field name="priority">1</field>
<field name="arch" type="xml">
<templates position="before">
<field name="attendance_state"/>
</templates>
<field name="name" position="replace">
<div id="row">
<div class="col-xs-11" style="padding:0px">
<strong>
<field name="name" placeholder="Employee's Name"/>
</strong>
<div>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span class="oe_kanban_status oe_kanban_status_green"></span>
</div>
<div class="col-xs-1" style="padding:0px">
<field name="attendance_state" widget="hr_attendance_kanban_presence_indicator"/>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span class="oe_kanban_status oe_kanban_status_red"></span>
</div>
<strong>
<field name="name" placeholder="Employee's Name"/>
</strong>
</div>
</field>
</field>
@@ -92,4 +99,4 @@
</field>
</record>
</odoo>
</odoo>