Files
odoo_source/addons/hr_attendance/views/res_config_settings_views.xml
T
Jorge Pinna PuissantandMichael Mattiello (mcm) c7c2959449 [IMP] web, *: simplification and standardization of the settings arch
The aim of this commit is to simplify and standardize the settings archs.

To do this, a small DSL exclusively for the settings was created. This
new DSL introduces 3 tags: `app`, `block` and `setting`.

The `app` tag is used to declare the application on the settings view.
It creates an entry with its logo on the sidebar of the view. It also
acts as delimiter when searching.

```xml
    <app string="CRM" name="crm">
    ...
    </app>
```

- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the
        logo is created using the `name` parameter :
        `/{name}/static/description/icon.png`.

The `block` tag is used to declare a group of settings. This group can
have a title and a description/help.

```xml
    <block title="Title of group Bar">
    ...
    </block>
```

- `title` *optional* : The title of the block of settings (the old h2),
        you can perform research on its text.
- `help` *optional* : The description/help of the block of settings
        (the old h3), you can perform research on its text.

The `setting` tag is used to declare the setting itself. The first field
in the setting is used as the main field (optional). This field is
placed on the left panel (if it's a boolean field) or on the top of the
right panel (otherwise). The field is also used to create the setting
label if a `string` is not defined. The `setting` tag can also contain
more elements (e.g. html), all of these elements are rendered in the
right panel.

```xml
    <setting string="this is bar">
        <field name="bar"/>
        ...More elements
    </setting>
```

- `type` *optional* : By default, a setting is visually separated on two
        panels (left and right), and is used to edit a given field. By
        defining `type='header'`, a special kind of setting is rendered
        instead. This setting is used to modify the scope of the other
        settings. For example, on the website application, this setting
        is used to indicate to which website the other settings apply.
        The header setting is visually represented as a yellow banner on
        the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's
        not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is
        displayed just below the setting label (with classname
        `text-muted`).
- `company_dependent` *optional* : If this attribute is set to "1" an
        icon is displayed next to the setting label to explicit that
        this setting is company-specific.
- `documentation` *optional* :  If this attribute is set, an icon is
        added next to the setting label, this icon is a link to the
        documentation. Note that you can use relative or absolute path.
        The relative path is relative to
        `https://www.odoo.com/documentation/server_version`, so it's not
        necessary to hard-code the server version on the arch anymore.

closes odoo/odoo#106425

Task-id: 3081367
Related: odoo/enterprise#34337
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
2022-12-02 14:40:25 +01:00

75 lines
5.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hr.attendance</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="80"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="inside">
<app data-string="Attendances" string="Attendances" name="hr_attendance" groups="hr_attendance.group_hr_attendance_manager">
<block title="Check-In/Out in Kiosk Mode" name="kiosk_mode_setting_container">
<setting company_dependent="1" help="Define the way the user will be identified by the application.">
<field name="attendance_kiosk_mode" required="1" class="w-75"/>
</setting>
<setting string="Display Time" company_dependent="1" help="Choose how long the greeting message will be displayed.">
<field name="attendance_kiosk_delay" required="1" class="text-center" style="width: 10%; min-width: 4rem;"/><span> seconds</span>
</setting>
</block>
<block name="pincode_setting_container">
<setting attrs="{'invisible': [('attendance_kiosk_mode', '=', 'manual')]}" company_dependent="1" help="Define the camera used for the barcode scan.">
<field name="attendance_barcode_source" required="1"/>
</setting>
<setting title="Set PIN codes in the employee detail form (in HR Settings tab)." attrs="{'invisible': [('attendance_kiosk_mode', '=', 'barcode')]}" help="Use PIN codes (defined on the Employee's profile) to check-in.">
<field name="group_attendance_use_pin"/>
</setting>
</block>
<block title="Extra Hours" name="overtime_settings">
<setting title="Activate the count of employees' extra hours." string="Count of Extra Hours" company_dependent="1" help="Compare attendance with working hours set on employee.">
<field name="hr_attendance_overtime"/>
<div class="mt16" attrs="{'invisible': [('hr_attendance_overtime', '=', False)],
'required': [('hr_attendance_overtime', '=', True)]}">
<div class="mt16 row" title="Count of extra hours is considered from this date. Potential extra hours prior to this date are not considered.">
<label for="overtime_start_date" string="Start from" class="col-3 col-lg-3 o_light_label"/>
<field name="overtime_start_date" class="col-lg-3 p-0" attrs="{'required': [('hr_attendance_overtime', '=', True)]}" />
</div>
<br/>
<label for="overtime_company_threshold" class="o_form_label">
Tolerance Time In Favor Of Company
</label>
<div class="text-muted">
Allow a period of time (around working hours) where extra time will not be counted, in benefit of the company
</div>
<span>Time Period </span><field name="overtime_company_threshold" class="text-center"
attrs="{'required': [('hr_attendance_overtime', '=', True)]}" style="width: 10%; min-width: 4rem;"/><span> Minutes</span>
<br/>
<br/>
<label for="overtime_employee_threshold" class="o_form_label">
Tolerance Time In Favor Of Employee
</label>
<div class="text-muted">
Allow a period of time (around working hours) where extra time will not be deducted, in benefit of the employee
</div>
<span>Time Period </span><field name="overtime_employee_threshold" class="text-center"
attrs="{'required': [('hr_attendance_overtime', '=', True)]}" style="width: 10%; min-width: 4rem;"/><span> Minutes</span>
</div>
</setting>
</block>
</app>
</xpath>
</field>
</record>
<record id="action_hr_attendance_settings" model="ir.actions.act_window">
<field name="name">Settings</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.config.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
<field name="context">{'module' : 'hr_attendance', 'bin_size': False}</field>
</record>
<menuitem id="hr_attendance.menu_hr_attendance_settings" name="Configuration" parent="menu_hr_attendance_root"
sequence="99" action="action_hr_attendance_settings" groups="hr_attendance.group_hr_attendance_manager"/>
</odoo>