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

433 lines
28 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_hr_payslip_tree" model="ir.ui.view">
<field name="name">hr.payslip.list</field>
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<list string="Payslips" edit="1" sample="1" multi_edit="1" duplicate="0" js_class="hr_payroll_payslip_list">
<header>
<button string="Validate" name="action_validate" type="object" class="oe_highlight"/>
<button string="Compute Sheet" name="compute_sheet" type="object" class="oe_highlight"/>
<button string="Confirm" name="action_payslip_done" type="object" class="oe_highlight" context="{'payslip_generate_pdf': True}"/>
<button string="Mark as Paid" name="action_payslip_paid" type="object" class="oe_highlight"/>
<button string="Print" name="action_print_payslip" type="object"/>
</header>
<field name="company_id" column_invisible="True"/>
<field name="currency_id" column_invisible="True"/>
<field name="employee_id" widget="many2one_avatar_employee" readonly="state != 'draft'"/>
<field name="employee_reference" optional="hide"/>
<field name="date_from" string="Period" widget="daterange" options="{'end_date_field': 'date_to', 'payrun_optional': 'hide'}" readonly="1"/>
<field name="date_to" invisible="1" column_invisible="1" readonly="1"/>
<field name="payslip_run_id" optional='show' widget="many2one" readonly="state != 'draft'" options="{'payrun_optional': 'hide', 'no_open': 0}" placeholder="Off-Cycle"/>
<field name="struct_id" optional="hide" readonly="state in ['cancel', 'validated', 'paid']"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" optional="hide"/>
<field name="employer_cost" widget="monetary" options="{'currency_field': 'currency_id'}" optional="show"/>
<field name="basic_wage" widget="monetary" options="{'currency_field': 'currency_id'}" optional="show"/>
<field name="gross_wage" widget="monetary" options="{'currency_field': 'currency_id'}" optional="show"/>
<field name="net_wage" widget="monetary" options="{'currency_field': 'currency_id'}" decoration-bf="1" optional="show"/>
<field
name="state_display" widget="badge"
decoration-info="state_display == 'draft'"
decoration-success="state_display == 'validated'"
decoration-primary="state_display == 'paid'"
decoration-warning="state_display == 'warning'"
decoration-danger="state_display == 'error'"/>
<field name="issues" widget="actionable_warnings" optional="hide" options="{'payrun_optional': 'show', 'first_only': True}"/>
<button string="Off-Cycle" help="Detach the payslip from the pay run to send it to the Off-Cycle" name="action_move_to_off_cycle" type="object" icon="fa-long-arrow-right" invisible="state != 'draft' or not payslip_run_id"/>
</list>
</field>
</record>
<record id="hr_payslip_view_kanban" model="ir.ui.view">
<field name="name">hr.payslip.kanban</field>
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" sample="1">
<field name="currency_id"/>
<templates>
<t t-name="card" class="row g-0">
<field name="employee_id" widget="many2one_avatar_employee" options="{'display_avatar_name': True}" readonly="state != 'draft'" class="col-6 fw-bold mb-1"/>
<div class="col-6">
<field name="state" class="float-end" widget="badge"
decoration-info="state == 'draft'"
decoration-success="state == 'validated'"
decoration-primary="state == 'paid'"
/>
</div>
<div>
<field name="date_from" readonly="state in ['cancel', 'validated', 'paid']"/> - <field name="date_to" readonly="state in ['cancel', 'validated', 'paid']"/>
</div>
<field name="name" readonly="state in ['cancel', 'validated', 'paid']"/>
<span>Net - <field name="net_wage"/></span>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_hr_payslip_form" model="ir.ui.view">
<field name="name">hr.payslip.form</field>
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<form string="Payslip" duplicate="0">
<header>
<button string="Confirm" name="action_payslip_done" type="object" invisible="state != 'draft' or not line_ids" class="oe_highlight" context="{'payslip_generate_pdf': True}"/>
<button string="Mark as paid" name="action_payslip_paid" type="object" class="oe_highlight" invisible="state != 'validated'"/>
<button string="Create Payment Report" name="action_payslip_payment_report" type="object" invisible="state != 'validated'"/>
<button string="Revert" name="refund_sheet" type='object' invisible="is_refunded or credit_note or state != 'paid'"
confirm="Are you sure you want to revert this payslip? This will create a negative of this payslip."/>
<button string="Revert" name="refund_sheet" type='object' invisible="not is_refunded or credit_note or state != 'paid'"
confirm="Another refund payslip with the same amount has been found. Do you want to create a new one?"/>
<button string="Set to Draft" name="action_payslip_draft" type="object" invisible="state != 'cancel'"/>
<button string="Unpaid" name="action_payslip_unpaid" type="object" invisible="state != 'paid'"/>
<button string="Compute Sheet" name="compute_sheet" type="object" invisible="state != 'draft' or line_ids or credit_note" class="oe_highlight" help="Recompute the payslip lines only, not the worked days / input lines"/>
<button string="Compute Sheet" name="compute_sheet" type="object" invisible="state != 'draft' or not line_ids or credit_note" help="Recompute the payslip lines only, not the worked days / input lines"/>
<button string="Cancel" name="action_payslip_cancel" type="object" invisible="state not in ('draft', 'validated')"/>
<button string="Print" name="action_print_payslip" type="object" invisible= "not line_ids"/>
<button string="Export Payslip" name="action_export_payslip" type="object" invisible="not is_superuser"/>
<field name="state" widget="statusbar" statusbar_visible="draft,validated,paid"/>
</header>
<div class="alert alert-warning d-flex align-items-center" role="alert"
invisible="(not has_wrong_data) or (is_refunded or is_corrected or keep_wrong_version or is_refund_payslip)">
The employee's data has been updated since this payslip was created.
<button type="object" class="btn btn-link ms-auto" name="action_adjust_payslip">Adjust payslip</button>
<button type="object" class="btn btn-link ms-2" name="action_keep_wrong_version">Keep it as is</button>
</div>
<div class="alert alert-warning d-flex align-items-center" role="alert"
invisible="(not is_wrong_version) or (is_refunded or is_corrected or keep_wrong_version or is_refund_payslip)">
Employee's record is not the latest version for this payslip period.
<button type="object" class="btn btn-link ms-auto" name="action_adjust_payslip">Adjust payslip</button>
<button type="object" class="btn btn-link ms-2" name="action_keep_wrong_version">Keep it as is</button>
</div>
<sheet>
<field name="issues" class="w-100" widget="actionable_warnings" invisible="not issues"/>
<div class="alert alert-warning mb-2 px-3 py-2" role="alert" invisible="not negative_net_to_report_display">
<field name="negative_net_to_report_message"/>
<button name="action_report_negative_amount" class="oe_link" type="object" string="Report" icon="oi-arrow-right"/>
</div>
<div class="oe_button_box" name="button_box">
<button type="object" class="oe_stat_button" name="action_open_related_payslips" id="open_related_payslips"
icon="fa-files-o" invisible="related_payslip_count == 0">
<field name="related_payslip_count" widget="statinfo" string="Related Payslips"/>
</button>
<button type="object" class="oe_stat_button" id="open_work_entries"
icon="fa-calendar" name="action_open_work_entries">
<div class="o_stat_info">
<span class="o_stat_text">
Work Entries
</span>
</div>
</button>
<button type="object" class="oe_stat_button" name="action_open_salary_attachments" id="open_salary_attachments"
icon="fa-files-o" invisible="salary_attachment_count == 0">
<field name="salary_attachment_count" widget="statinfo" string="Salary Adjustments"/>
</button>
</div>
<div class="row justify-content-between position-relative w-100 m-0">
<div class="oe_title mw-75 ps-0 pe-2" name="title">
<h1 class="d-flex flex-row align-items-center">
<field name="employee_id" placeholder="Employee" readonly="state != 'draft'" options="{'no_create': True}"/>
</h1>
</div>
<div class="o_employee_avatar mw-25 m-0 p-0">
<field name="image_1920" widget='image' class="oe_avatar m-0" options='{"zoom": true, "preview_image":"avatar_128"}'/>
</div>
</div>
<group name="top">
<group name="top_left">
<field name="company_id" invisible="1"/>
<field name="version_id" context="{'default_employee_id': employee_id}"
required="1" readonly="state in ['cancel', 'validated', 'paid']" string="Employee Record"
domain="[
('employee_id', '=', employee_id),
('date_start', '&lt;=', date_to),
'|',
('date_end', '=', False),
('date_end', '&gt;=', date_from)
]"
options="{
'no_create': True,
'no_create_edit': True,
}"/>
<field name="country_id" invisible="1"/>
<field name="country_code" invisible="1"/>
<field name="payslip_run_id" string="Pay Run" readonly="state != 'draft'" placeholder="Off-Cycle" context="{'default_date_start': date_from, 'default_date_end': date_to}"/>
<field name="struct_id" required="1" readonly="state in ['cancel', 'validated', 'paid']"
options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"
groups="!hr_payroll.group_hr_payroll_manager"/>
<field name="struct_id" required="1" readonly="state in ['cancel', 'validated', 'paid']"
groups="hr_payroll.group_hr_payroll_manager"/>
<field name="salary_attachment_ids" invisible="1" force_save="1"/>
<field name="wage_type" invisible="1"/>
<field name="sum_worked_hours" invisible="1"/>
<field name="credit_note" invisible="1" readonly="state != 'draft'"/>
<field name="is_superuser" invisible="1"/>
<field name="use_worked_day_lines" invisible="1"/>
<field name="payment_report_filename" invisible="1"/>
<field name="payment_report" filename="payment_report_filename" invisible="not payment_report"/>
<label for="date_from" string="Period"/>
<div>
<field name="date_from" class="oe_inline" readonly="state in ['cancel', 'validated', 'paid']"/> - <field name="date_to" class="oe_inline" readonly="state in ['cancel', 'validated', 'paid']"/>
</div>
</group>
</group>
<notebook>
<page string="Worked Days" name="worked_days" class="o_hr_payroll_worked_days" invisible="not use_worked_day_lines">
<field name="worked_days_line_ids" readonly="state in ['cancel', 'validated', 'paid']">
<list string="Worked Days" editable="bottom" create="0" delete="0">
<field name="work_entry_type_id" readonly="1" force_save="1"/>
<field name="name"/>
<field name="number_of_days" sum="Total Working Days" readonly="1" force_save="1" string="Days"/>
<field name="number_of_hours" widget="float_time" sum="Total Working Hours" readonly="1" force_save="1" string="Hours"/>
<field name="amount" readonly="1" sum="Total Amount" force_save="1"/>
<field name="ytd" readonly="1" force_save="1"
column_invisible="not parent.ytd_computation"
optional="show"/>
<field name="is_paid" readonly="1" column_invisible="True" force_save="1"/>
<field name="sequence" readonly="1" column_invisible="True" force_save="1"/>
<field name="currency_id" column_invisible="True"/>
</list>
</field>
</page>
<page string="Salary Inputs" class="o_hr_payroll_worked_days">
<field name="input_line_ids" colspan="4" nolabel="1" readonly="state in ['cancel', 'validated', 'paid']">
<list string="Input Data" editable="bottom">
<!--
Required 0 to force client to send on change request even when not defined
Salary Attachments would otherwise not properly be computed and payslip_id is
required for _allowed_input_type_ids to work..
-->
<field name="payslip_id" required="0" column_invisible="True"/>
<field name="_allowed_input_type_ids" column_invisible="True"/>
<field name="input_type_id"/>
<field name="name" string="Note"/>
<field name="amount" widget="float_without_trailing_zeros"/>
<field name="version_id" column_invisible="True"/>
<field name="sequence" column_invisible="True"/>
</list>
<form string="Payslip Line">
<group col="4">
<field name="payslip_id" invisible="1"/>
<field name="_allowed_input_type_ids" invisible="1"/>
<field name="input_type_id"/>
<field name="name"/>
<field name="sequence"/>
<field name="amount"/>
<field name="version_id"/>
</group>
</form>
</field>
<field name="currency_id" invisible="1"/>
<field name="payslip_properties" widget="properties"/>
<button name="action_configure_payslip_inputs" context="{'structure_id': struct_id}" type="object" icon="fa-plus" string="Add Inputs"
class="btn btn-secondary text-break m-0"/>
</page>
<page string="Salary Computation" name="salary_computation" class="o_hr_payroll_salary_computation">
<field name="line_ids" colspan="4" nolabel="1" readonly="state != 'draft'">
<list string="Salary Structure" editable="bottom" decoration-info="total == 0" create="0" delete="0">
<field name="name"/>
<field name="code" readonly="1" force_save="1" optional="hide"/>
<field name="category_id" readonly="1" force_save="1" optional="hide"/>
<field name="sequence" readonly="1" column_invisible="True" force_save="1"/>
<field name="quantity" readonly="1" force_save="1" optional="show"/>
<field name="rate" readonly="1" force_save="1" optional="show"/>
<field name="salary_rule_id" groups="base.group_no_one" readonly="1" force_save="1" optional="hide"/>
<field name="amount" readonly="1" force_save="1" optional="show"/>
<field name="total" readonly="1" force_save="1"/>
<field name="ytd" readonly="1" force_save="1"
column_invisible="not parent.ytd_computation"
optional="show"/>
<field name="currency_id" column_invisible="True"/>
</list>
<form string="Payslip Line">
<group col="4">
<field name="name"/>
<field name="code"/>
<field name="category_id"/>
<field name="sequence"/>
<field name="quantity"/>
<field name="rate"/>
<field name="amount"/>
<field name="total"/>
<field name="ytd" readonly="1" invisible="not parent.ytd_computation"/>
<field name="salary_rule_id"/>
<field name="currency_id" invisible="1"/>
</group>
</form>
</field>
</page>
<page string="Other Info" name="account_info">
<group>
<group>
<field name="name" readonly="state in ['cancel', 'validated', 'paid']"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</group>
<group name="accounting">
<field name="has_negative_net_to_report" invisible="1"/>
<field name="negative_net_to_report_display" invisible="1"/>
<field name="paid_date"/>
<field name="paid" invisible="1" readonly="state != 'draft'"/>
</group>
</group>
<div colspan="4">
<field name="note" placeholder="Add an internal note..." readonly="state != 'draft'"/>
</div>
</page>
</notebook>
</sheet>
<div class="o_attachment_preview" groups="hr_payroll.group_payslip_display"/>
<chatter/>
</form>
</field>
</record>
<record id="view_hr_payslip_pivot" model="ir.ui.view">
<field name="name">hr.payslip.pivot</field>
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<pivot string="Payslips" sample="1">
<field name="net_wage" type="measure"/>
<field name="department_id" type="row"/>
</pivot>
</field>
</record>
<record id="view_hr_payslip_filter" model="ir.ui.view">
<field name="name">hr.payslip.select</field>
<field name="model">hr.payslip</field>
<field name="arch" type="xml">
<search string="Search Payslips">
<field name="employee_id"/>
<field name="employee_id" string="Employee Reference" filter_domain="[('employee_id.registration_number', 'ilike', self)]"/>
<field name="name" string="Payslips" filter_domain="[('name', 'ilike', self)]"/>
<field name="date_from"/>
<field name="version_id"/>
<field name="payslip_run_id"/>
<field name="struct_id"/>
<field name="activity_user_id" string="Activities of"/>
<field name="activity_type_id" string="Activity type"/>
<filter
string="Has Issues" name="filter_issue"
domain="['|', ('error_count', '>', 0), ('warning_count', '>', 0)]"/>
<separator/>
<filter string="Draft" name="draft" domain="[('state', '=', 'draft')]" help="Draft Slip"/>
<filter string="Validated" name="validated" domain="[('state', '=', 'validated')]" help="Done Slip"/>
<filter string="Paid" name="paid" domain="[('state', '=', 'paid')]" help="Paid Slip"/>
<filter string="Cancelled" name="cancel" domain="[('state', '=', 'cancel')]" help="Canceled Slip"/>
<separator/>
<filter string="Date" name="date_filter" date="date_to" default_period="month-1"/>
<separator/>
<filter string="Off-Cycle" name="filter_off_cycle" domain="[('payslip_run_id', '=', False)]"/>
<filter string="Credit Notes" name="credit_note" domain="[('credit_note', '=', True)]"/>
<separator/>
<group>
<filter string="Employee" name="group_by_employee_id" context="{'group_by': 'employee_id'}"/>
<filter string="Employee Record" name="group_by_version_id" context="{'group_by': 'version_id'}"/>
<filter string="Department" name="group_by_department_id" context="{'group_by':'department_id'}"/>
<filter string="Job Position" name="group_by_job_id" context="{'group_by':'job_id'}"/>
<filter string="Status" name="group_by_state" context="{'group_by': 'state'}"/>
<filter string="Pay Run" name="group_by_batch" context="{'group_by': 'payslip_run_id'}"/>
<filter string="Structure" name="group_by_structure" context="{'group_by': 'struct_id'}"/>
<filter string="Company" name="group_by_company_id" groups="base.group_multi_company" context="{'group_by': 'company_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_hr_payslip_new" model="ir.actions.act_window">
<field name="name">Employee Payslips</field>
<field name="res_model">hr.payslip</field>
<field name="view_mode">form</field>
</record>
<record id="action_view_hr_payslip_month_form" model="ir.actions.act_window">
<field name="name">Employee Payslips</field>
<field name="res_model">hr.payslip</field>
<field name="path">payslips</field>
<field name="view_mode">list,kanban,form,activity</field>
<field name="search_view_id" ref="view_hr_payslip_filter"/>
</record>
<record id="act_hr_employee_payslip_list" model="ir.actions.act_window">
<field name="res_model">hr.payslip</field>
<field name="name">Payslips</field>
<field name="view_mode">list,form</field>
<field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_draft">
<field name="name">Set to Draft</field>
<field name="sequence" eval="10"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
records.action_payslip_draft()
</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_compute_payroll">
<field name="name">Compute Sheet</field>
<field name="sequence" eval="20"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
result = records.compute_sheet()
if isinstance(result, dict):
action = result
</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_confirm_payroll">
<field name="name">Confirm</field>
<field name="sequence" eval="30"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
if records:
records.with_context(payslip_generate_pdf=True).action_payslip_done()
</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_cancel_payroll">
<field name="name">Cancel</field>
<field name="sequence" eval="40"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="state">code</field>
<field name="code">
if records:
records.action_payslip_cancel()
</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_recompute_whole_sheet">
<field name="name">Recompute Whole Sheet</field>
<field name="sequence" eval="50"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_view_types">list,form</field>
<field name="state">code</field>
<field name="code">
records.action_refresh_from_work_entries()
</field>
</record>
<record model="ir.actions.server" id="action_hr_payroll_remove_from_payrun">
<field name="name">Send to Off-Cycle</field>
<field name="sequence" eval="50"/>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_view_types">list,form</field>
<field name="state">code</field>
<field name="code">
records.action_move_to_off_cycle()
</field>
</record>
</odoo>