Files
enterprise-addons/hr_payroll/views/hr_salary_attachment_views.xml
T

246 lines
15 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="hr_salary_attachment_view_tree" model="ir.ui.view">
<field name="name">hr.salary.attachment.list</field>
<field name="model">hr.salary.attachment</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<list string="Salary Adjustments" multi_edit="1">
<field name="employee_ids" widget="many2many_avatar_employee" readonly="has_done_payslip"/>
<field name="date_start" readonly="has_done_payslip"/>
<field name="description" readonly="has_done_payslip"/>
<field name="other_input_type_id" options="{'no_open': True, 'no_create_edit': True, 'no_create': True}" readonly="has_done_payslip"/>
<field name="monthly_amount_display" string="Amount"/>
<field name="total_amount_display" string="Until"/>
<field name="state" nolabel="1" widget="badge" decoration-success="state == 'open'" decoration-muted="state == 'close'" invisible="state == 'open' and employee_count &gt; 1"/>
<field name="paid_amount" optional="hide" widget="monetary" readonly="has_done_payslip"/>
<field name="date_end" optional="hide"/>
<field name="remaining_amount" optional="hide" widget="monetary"/>
</list>
</field>
</record>
<record id="hr_salary_attachment_employee_view_list" model="ir.ui.view">
<field name="name">hr.salary.attachment.list</field>
<field name="model">hr.salary.attachment</field>
<field name="inherit_id" ref="hr_payroll.hr_salary_attachment_view_tree"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<list position="attributes">
<attribute name="default_order">state desc</attribute>
<attribute name="decoration-muted">state == 'close'</attribute>
</list>
<list position="inside">
<control>
<button string="Add a salary adjustment" name="action_open_employee_salary_attachment" class="btn-link" type="object" context='{"new": 1}'/>
</control>
<button class="btn btn-link" string="Restart" icon="fa-play" type="object" name="action_open" invisible="state == 'open' or employee_count &gt; 1"/>
<button class="btn btn-link" string="Stop" icon="fa-stop" type="object" name="action_close" invisible="state == 'close' or employee_count &gt; 1"/>
<button class="btn btn-link" string="Split" icon="fa-scissors" type="object" name="action_split" invisible="employee_count &lt;= 1"/>
</list>
<field name="date_start" position="before">
<field name="other_input_type_id" position="move"/>
</field>
<field name="employee_ids" position="replace">
</field>
</field>
</record>
<record id="hr_salary_attachment_employee_view_kanban" model="ir.ui.view">
<field name="name">hr.salary.attachment.kanban</field>
<field name="model">hr.salary.attachment</field>
<field name="mode">primary</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" default_order="state desc">
<templates>
<t t-name="card">
<div class="d-flex justify-content-between">
<field name="other_input_type_id"/>
<field name="state" nolabel="1" widget="badge" decoration-success="state == 'open'"
decoration-muted="state == 'close'"
invisible="state == 'open' and employee_count &gt; 1"/>
</div>
<field name="date_start"/>
<field name="description"/>
<field name="monthly_amount_display"/>
<field name="total_amount_display"/>
</t>
</templates>
</kanban>
</field>
</record>
<record id="hr_salary_attachment_view_pivot" model="ir.ui.view">
<field name="name">hr.salary.attachment.pivot</field>
<field name="model">hr.salary.attachment</field>
<field name="arch" type="xml">
<pivot string="Salary Adjustments">
<field name="employee_ids" type="row"/>
<field name="other_input_type_id" type="col"/>
<field name="paid_amount"/>
<field name="remaining_amount"/>
<field name="monthly_amount" type="measure"/>
<field name="total_amount" type="measure"/>
</pivot>
</field>
</record>
<record id="hr_salary_attachment_view_form" model="ir.ui.view">
<field name="name">hr.salary.attachment.form</field>
<field name="model">hr.salary.attachment</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<form string="Salary Adjustment">
<header>
<button name="action_close" type="object" string="Mark as Completed"
invisible="state != 'open' or employee_count &gt; 1"/>
<button name="action_split" type="object" string="Create Individual Attachments"
class="oe_highlight" invisible="state != 'open' or employee_count &lt;= 1"/>
<button name="action_open" type="object" string="Running"
invisible="state != 'close' or employee_count &gt; 1"/>
<field name="state" widget="statusbar"
invisible="employee_count &gt; 1"/>
</header>
<div role="alert" class="alert alert-warning text-center" invisible="not has_similar_attachment">
<field name="has_similar_attachment_warning"/>
<field name="has_similar_attachment" invisible="1"/>
</div>
<sheet>
<div class="oe_button_box" name="button_box">
<button type="object" name="action_open_payslips" class="oe_stat_button"
icon="fa-money" id="open_payslips" invisible="payslip_count == 0">
<field name="payslip_count" widget="statinfo" string="Payslips" />
</button>
</div>
<!-- invisible fields to compute fields visibility in the form view -->
<field name="company_id" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="has_total_amount" invisible="1"/>
<field name="attachment_name" invisible="1"/>
<field name="employee_count" invisible="1"/>
<field name="has_done_payslip" invisible="1"/>
<field name="is_quantity" invisible="1"/>
<group>
<field name="employee_ids" widget="many2many_avatar_employee" readonly="has_done_payslip"
invisible="context.get('default_employee_ids')" domain="[('active', '=', True)]"/>
<field name="other_input_type_id" readonly="has_done_payslip" context="{'default_available_in_attachments': True}"/>
<label for="monthly_amount"/>
<span class="d-flex">
<span style="width: 150px">
<span invisible="not is_refund" class="me-1">-</span>
<field class="o_hr_narrow_field" name="monthly_amount" invisible="not is_quantity" widget="float"/>
<field class="o_hr_narrow_field" name="monthly_amount" invisible="is_quantity"/>
</span>
<label for="is_refund" class="me-4"/>
<field name="is_refund" readonly="has_done_payslip"/>
</span>
<field name="duration_type" widget="radio" options="{'horizontal': True}"/>
<span/>
<span>
from
<field name="date_start" style="width: 10ch;" readonly="has_done_payslip"/>
<span invisible="not duration_type == 'limited'">
until
<field name="total_amount" class="o_hr_narrow_field" invisible="not is_quantity or not has_total_amount" required="has_total_amount" widget="float"/>
<field name="total_amount" class="o_hr_narrow_field" invisible="is_quantity or not has_total_amount" required="has_total_amount"/>
<span invisible="is_quantity">paid</span>
</span>
</span>
<span invisible="(not date_estimated_end and not date_end and state == 'open') or duration_type != 'limited'"/>
<span class="text-muted" invisible="not date_estimated_end and (not date_end or state == 'open') or duration_type != 'limited'">
end in <field name="remaining_time" class="w-auto"/> :
<field name="date_estimated_end" style="width: 10ch;" invisible="not date_estimated_end"/>
<field name="date_end" style="width: 10ch;" invisible="not date_end or state == 'open'" readonly="has_done_payslip"/>
</span>
<field name="description" readonly="has_done_payslip" placeholder="Optional reason, or reference"/>
</group>
</sheet>
<chatter/>
</form>
</field>
</record>
<record id="hr_salary_attachment_employee_view_form" model="ir.ui.view">
<field name="name">hr.salary.attachment.form</field>
<field name="model">hr.salary.attachment</field>
<field name="inherit_id" ref="hr_payroll.hr_salary_attachment_view_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<header position="replace">
<field name="state" widget="statusbar" class="w-100"
invisible="not id or employee_count &gt; 1"/>
</header>
<div role="alert" position="after">
<div role="alert" class="alert alert-info d-flex align-items-center justify-content-center" invisible="employee_count &lt;= 1">
Multiple employees are attached to this salary adjustment.<button class="btn-link p-0" type="object" name="action_split">Split it in individual adjustment</button>
</div>
</div>
<chatter position="after">
<footer>
<button string="Save" special="save" data-hotkey="q" class="btn-primary"/>
<button string="Discard" special="cancel" data-hotkey="x" class="btn-secondary"/>
<button name="action_open" type="object" string="Restart" close="0"
invisible="state != 'close'"/>
<button name="action_close" type="object" string="Stop" close="0"
invisible="state != 'open' or not id or employee_count &gt; 1"/>
<button name="action_unlink" type="object" string="Remove" class="btn-danger ms-auto me-0" invisible="state != 'close' or employee_count &lt;= 1 or not id"/>
<button name="action_unlink" type="object" string="Delete" class="btn-danger ms-auto me-0" invisible="state != 'close' or employee_count &gt; 1 or not id"/>
</footer>
</chatter>
</field>
</record>
<record id="hr_salary_attachment_view_search" model="ir.ui.view">
<field name="name">hr.salary.attachment.search</field>
<field name="model">hr.salary.attachment</field>
<field name="arch" type="xml">
<search string="Search Salary Adjustment">
<field name="employee_ids"/>
<field name="description"/>
<field name="other_input_type_id"/>
<field name="state"/>
<filter string="Active" name="active_this_year"
domain="[
'&amp;', ('state', '=', 'open'),
('date_start', '&lt;=', ('today'))
]"/>
<filter string="Refunds" name="search_is_refund" domain="[('is_refund', '=', True)]"/>
<filter string="One Shots" name="search_one_shot" domain="[('duration_type', '=', 'one')]"/>
<filter string="Employee" name="employee_id_group" context="{'group_by': 'employee_ids'}"/>
<filter string="Type" name="other_input_type_id" context="{'group_by': 'other_input_type_id'}"/>
<filter string="Status" name="state" context="{'group_by': 'state'}"/>
<filter string="Duration" name="duration_type" context="{'group_by': 'duration_type'}"/>
</search>
</field>
</record>
<record id="action_hr_salary_attachment_new" model="ir.actions.act_window">
<field name="name">Salary Adjustment</field>
<field name="res_model">hr.salary.attachment</field>
<field name="view_mode">form</field>
</record>
<record id="hr_salary_attachment_action" model="ir.actions.act_window">
<field name="name">Salary Adjustment</field>
<field name="res_model">hr.salary.attachment</field>
<field name="view_mode">list,form,pivot</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Salary Adjustment ?
</p><p>
A Salary Adjustment is a recurring amount of money defined on the
employee and used in every payslip on an amount of time.<br/>
Ex. Money recovery, Child support, Assessment of salary, ...<br/><br/>
<a name="hr_payroll.action_hr_salary_attachment_new" type="action" class="btn btn-secondary">Create a Salary Adjustment</a>
</p>
</field>
</record>
<record id="hr_salary_attachment_action_view_employee" model="ir.actions.act_window">
<field name="name">Salary Adjustment</field>
<field name="res_model">hr.salary.attachment</field>
<field name="view_mode">list,form,pivot</field>
<field name="context">{"search_default_employee_ids": [active_id]}</field>
</record>
</odoo>