diff options
| author | Olivier Dony <odo@odoo.com> | 2020-08-14 18:06:04 +0000 |
|---|---|---|
| committer | Olivier Dony <odo@odoo.com> | 2020-08-14 23:06:24 +0000 |
| commit | 63e38dad8de9d59edc2b75433b4e3f761eda0f3c (patch) | |
| tree | 8cffd6b95ed1f8c97447c9af44fe9862f0c6c79a | |
| parent | 61c21213b282f9182eb3ddb5a709086aff311d22 (diff) | |
[FIX] base,hr*: adapt profile view to security fields
| -rw-r--r-- | addons/hr/views/res_users.xml | 273 | ||||
| -rw-r--r-- | addons/hr_holidays/views/hr_views.xml | 4 | ||||
| -rw-r--r-- | odoo/addons/base/views/res_users_views.xml | 103 |
3 files changed, 193 insertions, 187 deletions
diff --git a/addons/hr/views/res_users.xml b/addons/hr/views/res_users.xml index 5b2c4462eb2..d9711e0e9bc 100644 --- a/addons/hr/views/res_users.xml +++ b/addons/hr/views/res_users.xml @@ -37,150 +37,149 @@ <field name="model">res.users</field> <field name="inherit_id" ref="res_users_view_form_simple_modif"/> <field name="arch" type="xml"> - <form position="replace"> - <form create="false" js_class="hr_employee_profile_form"> - <field name="hr_presence_state" invisible="1"/> - <header> - <button name="preference_change_password" type="object" string="Change password" class="btn btn-secondary"/> - </header> - <sheet> - <div class="oe_button_box" name="button_box"> - <button - id="hr_presence_button" - class="oe_stat_button" - disabled="1" - 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"/> + <form position="attributes"> + <attribute name="create">false</attribute> + <attribute name="js_class">hr_employee_profile_form</attribute> + </form> + <notebook position="replace"> + <field name="hr_presence_state" invisible="1"/> + <header> + </header> + <sheet>$0</sheet> + </notebook> + <notebook position="before"> + <div class="oe_button_box" name="button_box"> + <button + id="hr_presence_button" + class="oe_stat_button" + disabled="1" + 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_text"> - Not Connected - </span> - </div> - <div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '!=', 'present')]}"> - <span class="o_stat_value" attrs="{'invisible': [('last_activity_time', '=', False)]}"> - <field name="last_activity_time"/> - </span> - <span class="o_stat_value" attrs="{'invisible': [('last_activity_time', '!=', False)]}"> - <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"> - <h1> - <field name="name" placeholder="Employee's Name" required="True" readonly="context.get('from_my_profile', False)"/> - </h1> - </div> - <div class="row"> - <h2 class="col-6"> - <field name="job_title" placeholder="Job Position" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </h2> + <div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '=', 'present')]}"> + <span class="o_stat_text"> + Not Connected + </span> + </div> + <div class="o_stat_info" attrs="{'invisible': [('hr_presence_state', '!=', 'present')]}"> + <span class="o_stat_value" attrs="{'invisible': [('last_activity_time', '=', False)]}"> + <field name="last_activity_time"/> + </span> + <span class="o_stat_value" attrs="{'invisible': [('last_activity_time', '!=', False)]}"> + <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"> + <h1> + <field name="name" placeholder="Employee's Name" required="True" readonly="context.get('from_my_profile', False)"/> + </h1> + </div> + <div class="row"> + <h2 class="col-6"> + <field name="job_title" placeholder="Job Position" attrs="{'readonly': [('can_edit', '=', False)]}"/> + </h2> + </div> + <group> + <group> + <field name="can_edit" invisible="1"/> + <field name="mobile_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> + <field name="work_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> + </group> + <group> + <field name="work_email" widget="email" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="work_location" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="company_id" invisible="1"/> + </group> + <group> + <field name="employee_parent_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="coach_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + </group> + </group> + </notebook> + <notebook position="inside"> + <page name="public" string="Work Information"> + <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" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="address_id" + context="{'show_address': 1}" + options='{"always_reload": True, "highlight_first_line": True}' + attrs="{'readonly': [('can_edit', '=', False)]}"/> + </group> + <group name="managers" string="Approvers" class="hide-group-if-empty"> + <!-- overridden in other modules --> + </group> + </div> </div> + </page> + <page name="personal_information" string="Private Information"> <group> - <group> - <field name="can_edit" invisible="1"/> - <field name="mobile_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> - <field name="work_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> + <group string="Contact Information"> + <field name="employee_ids" invisible="1"/> + <field name="address_home_id" + context="{ + 'show_address': 1, + 'default_employee_ids': employee_ids, + 'default_type': 'private', + 'form_view_ref': 'base.res_partner_view_form_private'}" + options='{"always_reload": True, "highlight_first_line": True}' + attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="private_email" string="Email" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="employee_phone" string="Phone" class="o_force_ltr" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> + <field name="employee_bank_account_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="km_home_work" attrs="{'readonly': [('can_edit', '=', False)]}"/> </group> - <group> - <field name="work_email" widget="email" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="work_location" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="company_id" invisible="1"/> + <group string="Citizenship"> + <field name="employee_country_id" options='{"no_open": True, "no_create": True}' attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="identification_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="passport_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="gender" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="birthday" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="place_of_birth" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="country_of_birth" attrs="{'readonly': [('can_edit', '=', False)]}"/> </group> - <group> - <field name="employee_parent_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="coach_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <group string="Marital Status"> + <field name="marital" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="spouse_complete_name" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])], 'readonly': [('can_edit', '=', False)]}"/> + <field name="spouse_birthdate" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])], 'readonly': [('can_edit', '=', False)]}"/> + </group> + <group string="Education"> + <field name="certificate" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="study_field" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="study_school" attrs="{'readonly': [('can_edit', '=', False)]}"/> + </group> + <group string="Dependant"> + <field name="children" attrs="{'readonly': [('can_edit', '=', False)]}"/> + </group> + <group string="Emergency"> + <field name="emergency_contact" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="emergency_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> + </group> + <group string="Work Permit" name="work_permit"> + <field name="visa_no" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="permit_no" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="visa_expire" attrs="{'readonly': [('can_edit', '=', False)]}"/> </group> </group> - <notebook> - <page name="preferences" string="Preferences"> - <div>$0</div> - </page> - <page name="public" string="Work Information"> - <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" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="address_id" - context="{'show_address': 1}" - options='{"always_reload": True, "highlight_first_line": True}' - attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - <group name="managers" string="Approvers" class="hide-group-if-empty"> - <!-- overridden in other modules --> - </group> - </div> - </div> - </page> - <page name="personal_information" string="Private Information"> - <group> - <group string="Contact Information"> - <field name="employee_ids" invisible="1"/> - <field name="address_home_id" - context="{ - 'show_address': 1, - 'default_employee_ids': employee_ids, - 'default_type': 'private', - 'form_view_ref': 'base.res_partner_view_form_private'}" - options='{"always_reload": True, "highlight_first_line": True}' - attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="private_email" string="Email" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="employee_phone" string="Phone" class="o_force_ltr" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> - <field name="employee_bank_account_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="km_home_work" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - <group string="Citizenship"> - <field name="employee_country_id" options='{"no_open": True, "no_create": True}' attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="identification_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="passport_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="gender" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="birthday" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="place_of_birth" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="country_of_birth" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - <group string="Marital Status"> - <field name="marital" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="spouse_complete_name" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])], 'readonly': [('can_edit', '=', False)]}"/> - <field name="spouse_birthdate" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])], 'readonly': [('can_edit', '=', False)]}"/> - </group> - <group string="Education"> - <field name="certificate" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="study_field" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="study_school" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - <group string="Dependant"> - <field name="children" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - <group string="Emergency"> - <field name="emergency_contact" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="emergency_phone" widget="phone" attrs="{'readonly': [('can_edit', '=', False)]}" options="{'enable_sms': false}"/> - </group> - <group string="Work Permit" name="work_permit"> - <field name="visa_no" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="permit_no" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="visa_expire" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - </group> - </page> - <page name="hr_settings" string="HR Settings"> - <group> - <group string='Status' name="active_group" invisible="1"></group> - <group string="Attendance" name="identification_group"> - <field name="pin" attrs="{'readonly': [('can_edit', '=', False)]}"/> - <field name="barcode" attrs="{'readonly': [('can_edit', '=', False)]}"/> - </group> - </group> - </page> - </notebook> - </sheet> - </form> - </form> + </page> + <page name="hr_settings" string="HR Settings"> + <group> + <group string='Status' name="active_group" invisible="1"></group> + <group string="Attendance" name="identification_group"> + <field name="pin" attrs="{'readonly': [('can_edit', '=', False)]}"/> + <field name="barcode" attrs="{'readonly': [('can_edit', '=', False)]}"/> + </group> + </group> + </page> + </notebook> </field> </record> diff --git a/addons/hr_holidays/views/hr_views.xml b/addons/hr_holidays/views/hr_views.xml index 3573d79b523..dbaf7d13360 100644 --- a/addons/hr_holidays/views/hr_views.xml +++ b/addons/hr_holidays/views/hr_views.xml @@ -259,7 +259,7 @@ <field name="model">res.users</field> <field name="inherit_id" ref="hr.res_users_view_form_profile"/> <field name="arch" type="xml"> - <button name="preference_change_password" position="before"> + <xpath expr="//header" position="inside"> <button name="%(hr_leave_action_new_request)d" string="Request Time off" type="action" @@ -268,7 +268,7 @@ string="Request Allocation" type="action" class="btn btn-primary"/> - </button> + </xpath> <xpath expr="//group[@name='managers']" position="inside"> <field name="leave_manager_id" attrs="{'readonly': [('can_edit', '=', False)]}"/> </xpath> diff --git a/odoo/addons/base/views/res_users_views.xml b/odoo/addons/base/views/res_users_views.xml index e46587ce88c..7325ba0739f 100644 --- a/odoo/addons/base/views/res_users_views.xml +++ b/odoo/addons/base/views/res_users_views.xml @@ -441,57 +441,64 @@ <h1> <field name="name" readonly="1" class="oe_inline"/> </h1> - <group name="preferences"> - <group> - <field name="email" widget="email" readonly="0"/> - </group> - <group> - <label for="lang"/> - <div class="o_row"> - <field name="lang" required="1" readonly="0"/> - <button - type="action" - name="%(base.res_lang_act_window)d" - class="btn-sm btn-link mb4 fa fa-globe" - aria-label="More languages" - groups="base.group_system" - title="More languages" - /> - </div> - <field name="tz" widget="timezone_mismatch" options="{'tz_offset_field': 'tz_offset'}" readonly="0"/> - <field name="tz_offset" invisible="1"/> - </group> - </group> - <group name="signature"> - <field name="signature" readonly="0"/> - </group> - <group name="status" string="Status" invisible="1"> - <field name="company_id" options="{'no_create': True}" readonly="0" - groups="base.group_multi_company"/> - </group> - <group name="preference_contact"></group> - <group> - <group> - <field name="api_keys_only_explicit" - readonly="0" - string="Require API key" - help="Only allow API (RPC) access using API keys, not login/password"/> - </group> - </group> - <group> - <label for="api_key_ids">API Keys</label> - <field name="api_key_ids" nolabel="1" colspan="4" readonly="0"> - <tree editable="bottom" create="false" delete="false"> - <field name="name"/> - <button type="object" name="remove" icon="fa-trash"/> - </tree> - </field> - <button string="Add Key" type="object" name="api_key_wizard"/> - </group> + <notebook> + <page string="Preferences"> + <group name="preferences"> + <group> + <field name="email" widget="email" readonly="0"/> + </group> + <group> + <label for="lang"/> + <div class="o_row"> + <field name="lang" required="1" readonly="0"/> + <button + type="action" + name="%(base.res_lang_act_window)d" + class="btn-sm btn-link mb4 fa fa-globe" + aria-label="More languages" + groups="base.group_system" + title="More languages" + /> + </div> + <field name="tz" widget="timezone_mismatch" options="{'tz_offset_field': 'tz_offset'}" readonly="0"/> + <field name="tz_offset" invisible="1"/> + </group> + </group> + <group name="signature"> + <field name="signature" readonly="0"/> + </group> + <group name="status" string="Status" invisible="1"> + <field name="company_id" options="{'no_create': True}" readonly="0" + groups="base.group_multi_company"/> + </group> + <group name="preference_contact"></group> + </page> + <page string="Account Security"> + <group name="auth" string="Authentication"> + <div> + <button name="preference_change_password" type="object" string="Change password" class="btn btn-secondary"/> + </div> + </group> + <group string="Developer API Keys"> + <div colspan="2" attrs="{'invisible': [('api_key_ids', '=', [])]}"> + <field name="api_key_ids" nolabel="1" colspan="4" readonly="0"> + <tree editable="bottom" create="false" delete="false"> + <field name="name"/> + <field name="scope"/> + <field name="create_date"/> + <button type="object" name="remove" icon="fa-trash"/> + </tree> + </field> + </div> + <div colspan="2"> + <button name="api_key_wizard" string="New API Key" type="object" class="btn btn-secondary"/> + </div> + </group> + </page> + </notebook> <footer> <button name="preference_save" type="object" string="Save" class="btn-primary"/> <button name="preference_cancel" string="Cancel" special="cancel" class="btn-secondary"/> - <button name="preference_change_password" type="object" string="Change password" class="btn-secondary"/> </footer> </form> </field> |
