[IMP] hr: improve employee profile usability (back2basics)

Improve the usability of the employees profile / "My Profile"

TaskID: 2048672

closes odoo/odoo#35587

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Kevin Baptiste
2019-08-13 13:00:40 +00:00
parent 39a0162b80
commit f9fafcdcfb
10 changed files with 51 additions and 68 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ class HrEmployeePrivate(models.Model):
# resource and user
# required on the resource, make sure required="True" set in the view
name = fields.Char(related='resource_id.name', store=True, readonly=False, tracking=True)
name = fields.Char(string="Employee Name", related='resource_id.name', store=True, readonly=False, tracking=True)
user_id = fields.Many2one('res.users', 'User', related='resource_id.user_id', store=True, readonly=False)
user_partner_id = fields.Many2one(related='user_id.partner_id', related_sudo=False, string="User's partner")
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True, readonly=False)
@@ -101,7 +101,7 @@ class HrEmployeePrivate(models.Model):
coach_id = fields.Many2one('hr.employee', 'Coach')
category_ids = fields.Many2many(
'hr.employee.category', 'employee_category_rel',
'emp_id', 'category_id', groups="hr.group_hr_user",
'emp_id', 'category_id', groups="hr.group_hr_manager",
string='Tags')
# misc
notes = fields.Text('Notes', groups="hr.group_hr_user")
+7 -8
View File
@@ -9,7 +9,7 @@
<search string="Employees">
<field name="name" string="Employees" filter_domain="['|',('work_email','ilike',self),('name','ilike',self)]"/>
<field name="department_id" operator="child_of"/>
<field name="category_ids" groups="hr.group_hr_user"/>
<field name="category_ids" groups="hr.group_hr_manager"/>
<field name="job_title" />
<field name="company_id" groups="base.group_multi_company"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
@@ -60,22 +60,21 @@
<div role="img" class="fa fa-fw fa-circle text-danger o_button_icon" attrs="{'invisible': [('hr_presence_state', '!=', 'absent')]}" aria-label="Not available" title="Not available"/>
<div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '=', 'present')]}">
<span class="o_stat_value">
<field name="last_activity"/>
</span>
<span class="o_stat_text">
Last Activity
Not Connected
</span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '!=', 'present')]}">
<span class="o_stat_text">Connected</span>
<span class="o_stat_value">
<field name="last_activity"/>
</span>
<span class="o_stat_text">Connected Since</span>
</div>
</button>
</div>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="image_1920" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_128"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="Employee's Name" required="True"/>
</h1>
@@ -252,7 +251,7 @@
<span t-if="record.job_title.raw_value" class="o_kanban_record_subtitle"><field name="job_title"/></span>
</div>
</div>
<field name="category_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="category_ids" widget="many2many_tags" options="{'color_field': 'color'}" groups="hr.group_hr_manager"/>
<ul>
<li id="last_login"/>
<li t-if="record.work_email.raw_value"><field name="work_email" /></li>
+20 -18
View File
@@ -18,16 +18,16 @@
<xpath expr="//field[@name='email']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group[@name='preferences']" position="before">
<separator string="Email &amp; Notifications" />
</xpath>
<field name="signature" position="replace" />
<xpath expr="//field[@name='company_id']" position="after">
<field name="signature" />
<xpath expr="//group[@name='preference_contact']" position="before">
<group>
<field name="signature" />
</group>
</xpath>
<xpath expr="//field[@name='company_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<button name="preference_change_password" position="replace"/>
</field>
</record>
@@ -50,38 +50,39 @@
<form position="replace">
<form create="false" js_class="hr_employee_profile_form">
<field name="hr_presence_state" invisible="1"/>
<header></header> <!-- Used by other modules to add buttons -->
<header>
<button name="preference_change_password" type="object" string="Change password" class="btn btn-primary"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
id="hr_presence_button"
class="oe_stat_button"
disabled="1"
attrs="{'invisible': [('hr_presence_state', '=', 'absent')]}">
invisible="context.get('from_my_profile', False)"
attrs="{'invisible': ['|', ('hr_presence_state', '=', 'absent')]}">
<div role="img" class="fa fa-fw fa-circle text-success o_button_icon" attrs="{'invisible': [('hr_presence_state', '!=', 'present')]}" aria-label="Available" title="Available"/>
<div role="img" class="fa fa-fw fa-circle text-warning o_button_icon" attrs="{'invisible': [('hr_presence_state', '!=', 'to_define')]}" aria-label="Away" title="Away"/>
<div role="img" class="fa fa-fw fa-circle text-danger o_button_icon" attrs="{'invisible': [('hr_presence_state', '!=', 'absent')]}" aria-label="Not available" title="Not available"/>
<div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '=', 'present')]}">
<span class="o_stat_value">
<field name="last_activity"/>
</span>
<span class="o_stat_text">
Last Activity
Not Connected
</span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '!=', 'present')]}">
<span class="o_stat_text">Connected</span>
<span class="o_stat_value">
<field name="last_activity"/>
</span>
<span class="o_stat_text">Connected Since</span>
</div>
</button>
</div>
<field name="image_1920" widget='image' class="oe_avatar" options='{"zoom": true, "preview_image":"image_128"}'/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="Employee's Name" required="True"/>
<field name="name" placeholder="Employee's Name" required="True" readonly="context.get('from_my_profile', False)"/>
</h1>
<field name="category_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" placeholder="Tags" groups="hr.group_hr_user"/>
</div>
<h2>
<field name="job_title" placeholder="Job Position"/>
@@ -90,12 +91,10 @@
<group>
<field name="mobile_phone" widget="phone"/>
<field name="work_phone" widget="phone"/>
<field name="work_email" widget="email"/>
</group>
<group>
<field name="department_id"/>
<field name="work_email" widget="email"/>
<field name="company_id" invisible="1"/>
<field name="employee_parent_id"/>
</group>
</group>
<notebook>
@@ -106,12 +105,14 @@
<div id="o_work_employee_container"> <!-- These two div are used to position org_chart -->
<div id="o_work_employee_main">
<group string="Location">
<field name="department_id"/>
<field name="address_id"
context="{'show_address': 1}"
options='{"always_reload": True, "highlight_first_line": True}'/>
<field name="work_location"/>
</group>
<group name="managers" string="Responsibles">
<field name="employee_parent_id"/>
<field name="coach_id"/>
</group>
</div>
@@ -186,6 +187,7 @@
<field name="name">Change my Preferences</field>
<field name="res_model">res.users</field>
<field name="view_mode">form</field>
<field name="context">{'from_my_profile': True}</field>
<field name="view_id" ref="hr.res_users_view_form_profile"/>
</record>
@@ -25,11 +25,11 @@
<div role="img" id="oe_hr_attendance_status" class="fa fa-fw fa-circle o_button_icon oe_hr_attendance_status_green" attrs="{'invisible': [('attendance_state', '=', 'checked_out')]}" aria-label="Available" title="Available"/>
<div role="img" id="oe_hr_attendance_status" class="fa fa-fw fa-circle o_button_icon oe_hr_attendance_status_red" attrs="{'invisible': [('attendance_state', '=', 'checked_in')]}" aria-label="Not available" title="Not available"/>
<div class="o_stat_info" attrs="{'invisible': ['|', ('last_check_in', '=', False), ('last_check_out', '!=', False)]}">
<span class="o_stat_text">Present Since</span>
<span class="o_stat_text">Attended Since</span>
<span class="o_stat_value"><field name="last_check_in" widget="relative_time"/></span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('last_check_out', '=', False)]}">
<span class="o_stat_text">Absent Since</span>
<span class="o_stat_text">Not Attended Since</span>
<span class="o_stat_value"><field name="last_check_out" widget="relative_time"/></span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('last_check_in', '!=', False)]}">
@@ -37,8 +37,8 @@
</div>
</button>
<button name="%(hr_attendance_action)d"
class="fa-clock-o"
icon="fa-calendar"
class="oe_stat_button"
icon="fa-clock-o"
type="action"
context="{'search_default_employee_id': active_id, 'search_default_check_in_filter': '1'}"
groups="base.group_user"
@@ -71,15 +71,16 @@
<button name="%(hr_attendance_action_my_attendances)d"
id="hr_attendance_button"
class="oe_stat_button"
invisible="context.get('from_my_profile', False)"
type="action" attrs="{'invisible': ['|', ('attendance_state', '=', False), '&amp;', ('hr_presence_state', '=', 'present'), ('attendance_state', '=', 'checked_out')]}">
<div role="img" id="oe_hr_attendance_status" class="fa fa-fw fa-circle o_button_icon oe_hr_attendance_status_green" attrs="{'invisible': [('attendance_state', '=', 'checked_out')]}" aria-label="Available" title="Available"/>
<div role="img" id="oe_hr_attendance_status" class="fa fa-fw fa-circle o_button_icon oe_hr_attendance_status_red" attrs="{'invisible': [('attendance_state', '=', 'checked_in')]}" aria-label="Not available" title="Not available"/>
<div class="o_stat_info" attrs="{'invisible': ['|', ('last_check_in', '=', False), ('last_check_out', '!=', False)]}">
<span class="o_stat_text">Present Since</span>
<span class="o_stat_text">Attended Since</span>
<span class="o_stat_value"><field name="last_check_in" widget="relative_time"/></span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('last_check_out', '=', False)]}">
<span class="o_stat_text">Absent Since</span>
<span class="o_stat_text">Not Attended Since</span>
<span class="o_stat_value"><field name="last_check_out" widget="relative_time"/></span>
</div>
<div class="o_stat_info" attrs="{'invisible': [('last_check_in', '!=', False)]}">
+9 -9
View File
@@ -151,13 +151,13 @@
class="oe_stat_button"
context="{'search_default_employee_id': active_id}"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div role="img" class="fa fa-fw fa-plane o_button_icon text-danger" aria-label="Absent Until" title="Absent Until"/>
<div role="img" class="fa fa-fw fa-plane o_button_icon text-danger" aria-label="Off Till" title="Off Till"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="leave_date_to"/>
</span>
<span class="o_stat_text">
Absent Until
Off Till
</span>
</div>
</button>
@@ -171,7 +171,7 @@
help="Remaining leaves">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="allocation_used_display"/>/<field name="allocation_display"/>
<field name="allocation_used_display"/>/<field name="allocation_display"/> Days
</span>
<span class="o_stat_text">
Time Off
@@ -197,13 +197,13 @@
<button disabled="1"
class="oe_stat_button"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div role="img" class="fa fa-fw fa-plane o_button_icon text-warning" aria-label="Absent Until" title="Absent Until"/>
<div role="img" class="fa fa-fw fa-plane o_button_icon text-warning" aria-label="Off Till" title="Off Till"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="leave_date_to"/>
</span>
<span class="o_stat_text">
Absent Until
Off Till
</span>
</div>
</button>
@@ -237,14 +237,15 @@
<field name="is_absent" invisible="1"/>
<button name="%(hr_leave_action_new_request)d" type="action"
class="oe_stat_button"
invisible="context.get('from_my_profile', False)"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div role="img" class="fa fa-fw fa-plane o_button_icon text-danger" aria-label="Absent Until" title="Absent Until"/>
<div role="img" class="fa fa-fw fa-plane o_button_icon text-danger" aria-label="Off Till" title="Off Till"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="leave_date_to"/>
</span>
<span class="o_stat_text">
Absent Until
Off Till
</span>
</div>
</button>
@@ -257,8 +258,7 @@
help="Remaining leaves">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="allocation_used_display"/>/
<field name="allocation_display"/>
<field name="allocation_used_display"/>/<field name="allocation_display"/> Days
</span>
<span class="o_stat_text">
Time Off
+4 -4
View File
@@ -8,9 +8,9 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<field name="out_of_office_message" position="after">
<field name="livechat_username" string="Online Chat Username" readonly="0"/>
</field>
<xpath expr="//field[@name='tz']" position="after">
<field name="livechat_username" string="Online Chat Name" readonly="0"/>
</xpath>
</field>
</record>
@@ -20,7 +20,7 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='messaging']" position="inside">
<xpath expr="//group[@name='messaging']" position="after">
<group name="livechat" string="Livechat">
<field name="livechat_username"/>
</group>
-3
View File
@@ -12,9 +12,6 @@
<field name="email" position="before">
<field name="notification_type" widget="radio" readonly="0"/>
</field>
<xpath expr="//group[@name='status']" position="inside">
<field name="out_of_office_message" readonly="0"/>
</xpath>
</data>
</field>
</record>
@@ -8,27 +8,11 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<field name="company_id" position="before">
<field name="karma" string="Forum Karma"/>
</field>
<div name="button_box" position="inside">
<field name="is_published" widget="website_redirect_button"/>
</div>
</field>
</record>
<record id="res_users_view_form_preference" model="ir.ui.view">
<field name="name">res.users.form.preference.forum</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<data>
<field name="company_id" position="before">
<field name="karma" string="Forum Karma" readonly="1"/>
</field>
</data>
</field>
</record>
</data>
</odoo>
+1 -1
View File
@@ -224,7 +224,7 @@ class Users(models.Model):
help="Specify a value only when creating a user or if you're "\
"changing the user's password, otherwise leave empty. After "\
"a change of password, the user has to login again.")
signature = fields.Html()
signature = fields.Html(string="Email Signature")
active = fields.Boolean(default=True)
active_partner = fields.Boolean(related='partner_id.active', readonly=True, string="Partner is Active")
action_id = fields.Many2one('ir.actions.actions', string='Home Action',
+1 -1
View File
@@ -231,7 +231,7 @@
<field name="action_id"/>
</group>
</group>
<group string="Messaging and Social" name="messaging">
<group name="messaging">
<field name="signature"/>
</group>
</page>