[IMP] hr, hr_attendance: badge creation and few usability improvement

hr:
-rename btn 'generate badge ID' to 'generate'
-When the badge ID is set, replace the button Generate by "Print Badge"

hr_attendance:
-Rename menu 'Manage Attendances' to "Manager"
-Add a column "Work Hours" to attendee tree view
-Add a <br> after "Welcome to"
-add class text-muted on "or"
-remove class "text-muted" on "scan your badge
-Rename the primary btn into "Identify Manually"

Task-2040884
Closes: #35473

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
This commit is contained in:
Sapan Zaveri
2019-08-09 08:36:52 +00:00
parent 7cb9518857
commit dafb128c14
6 changed files with 22 additions and 9 deletions
+1 -1
View File
@@ -30,6 +30,7 @@
'views/hr_plan_views.xml',
'views/hr_employee_category_views.xml',
'views/hr_employee_public_views.xml',
'report/hr_employee_badge.xml',
'views/hr_employee_views.xml',
'views/hr_department_views.xml',
'views/hr_views.xml',
@@ -38,7 +39,6 @@
'views/mail_channel_views.xml',
'views/res_users.xml',
'data/hr_data.xml',
'report/hr_employee_badge.xml'
],
'demo': [
'data/hr_demo.xml'
+7 -3
View File
@@ -179,9 +179,13 @@
<field name="user_id" string="Related User"/>
</group>
<group string="Attendance" name="identification_group">
<field name="pin"/>
<field name="barcode"/>
<button string="Generate Badge ID" class="btn btn-primary" type="object" name="generate_random_barcode" attrs="{'invisible': [('barcode', '!=', False)]}"/>
<field name="pin" string="PIN Code"/>
<label for="barcode"/>
<div class="o_row">
<field name="barcode"/>
<button string="Generate" class="btn btn-link" type="object" name="generate_random_barcode" attrs="{'invisible': [('barcode', '!=', False)]}"/>
<button name="%(hr_employee_print_badge)d" string="Print Badge" class="btn btn-link" type="action" attrs="{'invisible': [('barcode', '=', False)]}"/>
</div>
</group>
</group>
</page>
@@ -111,6 +111,7 @@ class HrEmployeeBase(models.AbstractModel):
action_message['employee_name'] = employee.name
action_message['barcode'] = employee.barcode
action_message['next_action'] = next_action
action_message['hours_today'] = employee.hours_today
if employee.user_id:
modified_attendance = employee.with_user(employee.user_id)._attendance_action_change()
@@ -50,6 +50,12 @@ var GreetingMessage = AbstractAction.extend({
this.format_time = 'HH:mm:ss';
this.attendance.check_in_time = this.attendance.check_in && this.attendance.check_in.format(this.format_time);
this.attendance.check_out_time = this.attendance.check_out && this.attendance.check_out.format(this.format_time);
if (action.hours_today) {
var duration = moment.duration(action.hours_today, "hours");
this.hours_today = duration.hours() + ' hours, ' + duration.minutes() + ' minutes';
}
this.employee_name = action.employee_name;
this.attendanceBarcode = action.barcode;
},
@@ -10,19 +10,19 @@
<span class="o_hr_attendance_kiosk_backdrop"/>
<div class="o_hr_attendance_clock text-center"/>
<div class="o_hr_attendance_kiosk_mode">
<h1><small>Welcome to</small> <t t-esc="widget.company_name"/></h1>
<h1><small>Welcome to</small><br/> <t t-esc="widget.company_name"/></h1>
<img t-attf-src="{{widget.company_image_url}}" alt="Company Logo" class="o_hr_attendance_kiosk_company_image"/>
<div class="row o_hr_attendance_kiosk_welcome_row">
<div class="col-sm-5">
<img class="img img-fluid d-block mx-auto" src="/hr_attendance/static/src/img/barcode.png"/>
<h5 class="mt8 mb0 text-muted">Scan your badge</h5>
<h5 class="mt8 mb0">Scan your badge</h5>
</div>
<div class="col-sm-2">
<h3 class="mt0 mb8"><i>or</i></h3>
<h3 class="mt0 mb8 text-muted"><i>or</i></h3>
</div>
<div class="col-sm-5">
<button class="o_hr_attendance_button_employees btn btn-primary mb16">
<div class="mb16 mt16">Select Employee</div>
<div class="mb16 mt16">Identify<br/>Manually</div>
</button>
</div>
</div>
@@ -116,6 +116,7 @@
<h2 class="o_hr_attendance_message_message mt4 mb24"/>
<div class="alert alert-info h2 mt0" role="status">
Checked out at <b><t t-esc="widget.attendance.check_out_time"/></b>
<br/><b><t t-esc="widget.hours_today"/></b>
</div>
<h3 class="o_hr_attendance_random_message mb24"/>
<div class="o_hr_attendance_warning_message mt24 alert alert-warning" style="display:none" role="alert"/>
@@ -11,6 +11,7 @@
<field name="employee_id"/>
<field name="check_in"/>
<field name="check_out"/>
<field name="worked_hours" string="Work Hours" widget="float_time"/>
</tree>
</field>
</record>
@@ -178,7 +179,7 @@
<menuitem id="menu_hr_attendance_my_attendances" name="Check In / Check Out" parent="menu_hr_attendance_root" sequence="10" groups="hr_attendance.group_hr_attendance" action="hr_attendance_action_my_attendances"/>
<menuitem id="menu_hr_attendance_manage_attendances" name="Manage Attendances" parent="menu_hr_attendance_root" sequence="20" groups="hr_attendance.group_hr_attendance_user"/>
<menuitem id="menu_hr_attendance_manage_attendances" name="Manager" parent="menu_hr_attendance_root" sequence="20" groups="hr_attendance.group_hr_attendance_user"/>
<menuitem id="menu_hr_attendance_view_attendances" name="Attendances" parent="menu_hr_attendance_manage_attendances" sequence="10" groups="hr_attendance.group_hr_attendance_user" action="hr_attendance_action"/>