[IMP] hr: simplify and correct the default data

Some changes were made to the default/demo/test data to be more
consistent:
  - Duplicates of "Paid Time Off" time off types are consolidated into
    one type (inluding year specific versions, ig "Paid Time Off 2019"
  - Annual Time Off is renamed back to Paid Time Off (both for the
    work entry type as the time off type) to be consistent everywhere.
  - All mentions of years in work entry types and time off types have
    been removed, as this is no longer relevant with the new allocation
    rules.
  - Time off types in the default data have been explicitely made
    company agnostic, in order for them to be available to all companies
    and not just the one company that was select when installing
    hr_holidays. This was already the case for the be_payroll data, but
    not for the standard hr_holidays ones.
  - Various small cosmetic / functional fixes and simplifications
    (eg deduplication of data)
  - expense_other_input has been made country agnostic, in order for it
    to be available in all countries.

task-2978513

closes odoo/odoo#112208

X-original-commit: dcc8bbf
Related: odoo/enterprise#36819
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Rob Coekaerts
2023-02-15 10:14:31 +01:00
committed by Kevin Baptiste
parent 5add1d2610
commit 7cd00c0702
8 changed files with 40 additions and 14 deletions
+9 -1
View File
@@ -263,6 +263,8 @@
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="icon_id" ref="hr_holidays.icon_14"/>
<field name="color">2</field>
<field name="company_id" eval="False"/> <!-- Explicitely set to False for it to be available to all companies -->
<field name="sequence">1</field>
</record>
<!-- Sick leave -->
@@ -272,8 +274,10 @@
<field name="leave_notif_subtype_id" ref="mt_leave_sick"/>
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="support_document">True</field>
<field name="icon_id" ref="hr_holidays.icon_21"/>
<field name="icon_id" ref="hr_holidays.icon_22"/>
<field name="color">3</field>
<field name="company_id" eval="False"/> <!-- Explicitely set to False for it to be available to all companies -->
<field name="sequence">2</field>
</record>
<!-- Compensatory Days -->
@@ -288,6 +292,8 @@
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="icon_id" ref="hr_holidays.icon_4"/>
<field name="color">4</field>
<field name="company_id" eval="False"/> <!-- Explicitely set to False for it to be available to all companies -->
<field name="sequence">4</field>
</record>
<!--Unpaid Time Off -->
@@ -302,6 +308,8 @@
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="icon_id" ref="hr_holidays.icon_28"/>
<field name="color">5</field>
<field name="company_id" eval="False"/> <!-- Explicitely set to False for it to be available to all companies -->
<field name="sequence">3</field>
</record>
</data>
</odoo>
@@ -14,6 +14,7 @@
<field name="leave_validation_type">both</field>
<field name="allocation_validation_type">officer</field>
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="icon_id" ref="hr_holidays.icon_11"/>
</record>
<record id="holiday_status_training" model="hr.leave.type">
@@ -23,6 +24,7 @@
<field name="leave_validation_type">both</field>
<field name="allocation_validation_type">officer</field>
<field name="responsible_ids" eval="[(4, ref('base.user_admin'))]"/>
<field name="icon_id" ref="hr_holidays.icon_26"/>
</record>
<!-- Accrual Plan -->
@@ -258,7 +260,11 @@
<field eval="(datetime.now() + relativedelta(day=5, weekday=0) + relativedelta(weekday=2)).strftime('%Y-%m-%d 20:00:00')" name="request_date_to"/>
<field name="employee_id" ref="hr.employee_mit"/>
<field name="employee_ids" eval="[(4, ref('hr.employee_mit'))]"/>
<field name="state">confirm</field>
</record>
<function model="hr.leave" name="action_approve">
<value eval="ref('hr_holidays.hr_holidays_cl_mit_2')"/>
</function>
<!-- ++++++++++++++++++++++ Marc Demo ++++++++++++++++++++++ -->
@@ -381,6 +387,9 @@
<field name="employee_ids" eval="[(4, ref('hr.employee_niv'))]"/>
<field name="state">confirm</field>
</record>
<function model="hr.leave" name="action_validate">
<value eval="ref('hr_holidays.hr_holidays_cl_vad')"/>
</function>
<record id="hr_holidays_sl_vad" model="hr.leave">
<field name="name">Doctor Appointment</field>
@@ -433,6 +442,9 @@
<field name="employee_ids" eval="[(4, ref('hr.employee_jve'))]"/>
<field name="state">confirm</field>
</record>
<function model="hr.leave" name="action_validate">
<value eval="ref('hr_holidays.hr_holidays_sl_kim')"/>
</function>
<record id="hr_holidays_sl_kim_2" model="hr.leave">
<field name="name">Second dentist appointment</field>
@@ -445,6 +457,9 @@
<field name="employee_ids" eval="[(4, ref('hr.employee_jve'))]"/>
<field name="state">confirm</field>
</record>
<function model="hr.leave" name="action_validate">
<value eval="ref('hr_holidays.hr_holidays_sl_kim_2')"/>
</function>
<!-- Public time off -->
<record id="resource_public_time_off_1" model="resource.calendar.leaves">
@@ -455,5 +470,13 @@
<field name="date_to" eval="(datetime.today() + relativedelta(days=+8)).strftime('%Y-%m-%d 16:00:00')"></field>
</record>
<!-- Stress day -->
<record id="hr_leave_stress_day_1" model="hr.leave.stress.day">
<field name="name">Company Celebration</field>
<field name="company_id" ref="base.main_company"/>
<field name="start_date" eval="(datetime.today() + relativedelta(days=+7)).strftime('%Y-%m-%d 07:00:00')"></field>
<field name="end_date" eval="(datetime.today() + relativedelta(days=+7)).strftime('%Y-%m-%d 16:00:00')"></field>
<field name="color">9</field>
</record>
</data>
</odoo>
@@ -730,7 +730,7 @@ class TestAccessRightsUnlink(TestHrHolidaysAccessRightsCommon):
'holiday_status_id': self.leave_type.id,
'state': 'draft',
}
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=6), 1, values)
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=5), 1, values)
leave.with_user(self.user_employee.id).unlink()
def test_leave_unlink_confirm_by_user(self):
@@ -741,7 +741,7 @@ class TestAccessRightsUnlink(TestHrHolidaysAccessRightsCommon):
'holiday_status_id': self.leave_type.id,
'state': 'confirm',
}
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=6), 1, values)
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=5), 1, values)
leave.with_user(self.user_employee.id).unlink()
def test_leave_unlink_confirm_in_past_by_user(self):
@@ -763,7 +763,7 @@ class TestAccessRightsUnlink(TestHrHolidaysAccessRightsCommon):
'employee_id': self.employee_emp.id,
'holiday_status_id': self.leave_type.id,
}
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=6), 1, values)
leave = self.request_leave(self.user_employee_id, datetime.now() + relativedelta(days=5), 1, values)
leave.with_user(self.user_hrmanager_id).write({'state': 'validate'})
with self.assertRaises(UserError), self.cr.savepoint():
leave.with_user(self.user_employee.id).unlink()
@@ -10,6 +10,7 @@
<field name="active" eval="False"/>
<field name="company_id" eval="False"/>
<field name="icon_id" ref="hr_holidays.icon_9"/>
<field name="sequence">5</field>
</record>
<!-- The record above should be archived if no company has overtime counting enabled, otherwise enabled -->
@@ -39,7 +39,7 @@
</record>
<record id="work_entry_type_legal_leave" model="hr.work.entry.type">
<field name="name" eval="'Legal Leaves '+time.strftime('%Y')"/>
<field name="name">Paid Time Off</field>
<field name="code">LEAVE120</field>
<field name="is_leave">True</field>
<field name="color">5</field>
@@ -16,6 +16,7 @@ This application allows you to integrate time off in payslips.
""",
'depends': ['hr_holidays', 'hr_work_entry_contract'],
'data': [
'data/hr_payroll_holidays_data.xml',
'views/hr_leave_views.xml',
'views/hr_leave_type_views.xml',
],
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- add work_entry type to leave type -->
<record id="hr_holidays.holiday_status_unpaid" model="hr.leave.type">
<field name="work_entry_type_id" ref="hr_work_entry_contract.work_entry_type_unpaid_leave"></field>
</record>
<record id="hr_holidays.holiday_status_comp" model="hr.leave.type">
<field name="work_entry_type_id" ref="hr_work_entry_contract.work_entry_type_leave"></field>
</record>
<record id="hr_holidays.resource_public_time_off_1" model="resource.calendar.leaves">
<field name="work_entry_type_id" ref="hr_work_entry_contract.work_entry_type_leave"></field>
</record>
+2 -1
View File
@@ -47,7 +47,8 @@
<record id="resource_calendar_std_38h" model="resource.calendar">
<field name="name">Standard 38 hours/week</field>
<field name="company_id" ref="base.main_company"/>
<field name="company_id" eval="False"/>
<field name="hours_per_day">7.6</field>
<field name="attendance_ids"
eval="[(5, 0, 0),
(0, 0, {'name': 'Monday Morning', 'dayofweek': '0', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}),