diff options
| author | Sapan Zaveri <sza@odoo.com> | 2019-07-31 13:25:10 +0000 |
|---|---|---|
| committer | Sapan Zaveri <sza@odoo.com> | 2019-08-09 08:36:52 +0000 |
| commit | dafb128c14135fdb4bd3652dd890dcdb9c8751fa (patch) | |
| tree | 71cd76f2ef4ef4e99f3bcf68a70f2cf0a4e5bc5a | |
| parent | 7cb95188579909fb46d4002bc101de8b8cffcf98 (diff) | |
[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>
| -rw-r--r-- | addons/hr/__manifest__.py | 2 | ||||
| -rw-r--r-- | addons/hr/views/hr_employee_views.xml | 10 | ||||
| -rw-r--r-- | addons/hr_attendance/models/hr_employee.py | 1 | ||||
| -rw-r--r-- | addons/hr_attendance/static/src/js/greeting_message.js | 6 | ||||
| -rw-r--r-- | addons/hr_attendance/static/src/xml/attendance.xml | 9 | ||||
| -rw-r--r-- | addons/hr_attendance/views/hr_attendance_view.xml | 3 |
6 files changed, 22 insertions, 9 deletions
diff --git a/addons/hr/__manifest__.py b/addons/hr/__manifest__.py index bcbd2fafdf9..78dbafe5450 100644 --- a/addons/hr/__manifest__.py +++ b/addons/hr/__manifest__.py @@ -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' diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml index 3810e5e2312..0dca0f5a8f8 100644 --- a/addons/hr/views/hr_employee_views.xml +++ b/addons/hr/views/hr_employee_views.xml @@ -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> diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index 208fa37ac1d..f52b2acb11e 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -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() diff --git a/addons/hr_attendance/static/src/js/greeting_message.js b/addons/hr_attendance/static/src/js/greeting_message.js index 064ac919f08..c8d007b986b 100644 --- a/addons/hr_attendance/static/src/js/greeting_message.js +++ b/addons/hr_attendance/static/src/js/greeting_message.js @@ -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; }, diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml index f0be4eddb6c..429f06249f5 100644 --- a/addons/hr_attendance/static/src/xml/attendance.xml +++ b/addons/hr_attendance/static/src/xml/attendance.xml @@ -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"/> diff --git a/addons/hr_attendance/views/hr_attendance_view.xml b/addons/hr_attendance/views/hr_attendance_view.xml index bd416202f2f..0d973f92243 100644 --- a/addons/hr_attendance/views/hr_attendance_view.xml +++ b/addons/hr_attendance/views/hr_attendance_view.xml @@ -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"/> |
