-
Stress Days
+
+
Mandatory Days
- -
+
-
- :
+ t-esc="getFormattedDateSpan(mandatoryDay.start, mandatoryDay.end)"
+ t-att-class="'hr_mandatory_day_'+mandatoryDay.colorIndex"/>
+ :
diff --git a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.js b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.js
index 0349a89a944..d4772bc7911 100644
--- a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.js
+++ b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.js
@@ -9,5 +9,5 @@ TimeOffCalendarYearPopover.components = { Dialog };
TimeOffCalendarYearPopover.template = "web.CalendarYearPopover";
TimeOffCalendarYearPopover.subTemplates = {
...CalendarYearPopover.subTemplates,
- body: "hr_holidays.StressDayCalendarYearPopover.body",
+ body: "hr_holidays.MandatoryDayCalendarYearPopover.body",
};
diff --git a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.xml b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.xml
index eb47650baec..a4be527e96d 100644
--- a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.xml
+++ b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_popover.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_renderer.js b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_renderer.js
index b30211269aa..7a4ead2aeac 100644
--- a/addons/hr_holidays/static/src/views/calendar/year/calendar_year_renderer.js
+++ b/addons/hr_holidays/static/src/views/calendar/year/calendar_year_renderer.js
@@ -3,7 +3,7 @@
import { CalendarYearRenderer } from '@web/views/calendar/calendar_year/calendar_year_renderer';
import { useService } from "@web/core/utils/hooks";
-import { useStressDays } from '../../hooks';
+import { useMandatoryDays } from '../../hooks';
import { useCalendarPopover } from '@web/views/calendar/hooks';
import { TimeOffCalendarYearPopover } from './calendar_year_popover';
@@ -13,9 +13,9 @@ export class TimeOffCalendarYearRenderer extends CalendarYearRenderer {
setup() {
super.setup();
this.orm = useService("orm");
- this.stressDays = useStressDays(this.props);
- this.stressDaysList = [];
- this.stressDayPopover = useCalendarPopover(TimeOffCalendarYearPopover);
+ this.mandatoryDays = useMandatoryDays(this.props);
+ this.mandatoryDaysList = [];
+ this.mandatoryDayPopover = useCalendarPopover(TimeOffCalendarYearPopover);
useEffect((el) => {
for (const week of el) {
@@ -41,23 +41,23 @@ export class TimeOffCalendarYearRenderer extends CalendarYearRenderer {
/** @override **/
async onDateClick(info) {
- const is_stress_day = [...info.dayEl.classList].some(elClass => elClass.startsWith('hr_stress_day_'))
- this.stressDayPopover.close();
- if (is_stress_day && !this.env.isSmall) {
+ const is_mandatory_day = [...info.dayEl.classList].some(elClass => elClass.startsWith('hr_mandatory_day_'))
+ this.mandatoryDayPopover.close();
+ if (is_mandatory_day && !this.env.isSmall) {
this.popover.close();
const date = luxon.DateTime.fromISO(info.dateStr);
const target = info.dayEl;
- const stress_days_data = await this.orm.call("hr.employee", "get_stress_days_data", [date, date]);
- stress_days_data.forEach(stress_day_data => {
- stress_day_data['start'] = luxon.DateTime.fromISO(stress_day_data['start'])
- stress_day_data['end'] = luxon.DateTime.fromISO(stress_day_data['end'])
+ const mandatory_days_data = await this.orm.call("hr.employee", "get_mandatory_days_data", [date, date]);
+ mandatory_days_data.forEach(mandatory_day_data => {
+ mandatory_day_data['start'] = luxon.DateTime.fromISO(mandatory_day_data['start'])
+ mandatory_day_data['end'] = luxon.DateTime.fromISO(mandatory_day_data['end'])
});
const records = Object.values(this.props.model.records).filter((r) =>
luxon.Interval.fromDateTimes(r.start.startOf("day"), r.end.endOf("day")).contains(date)
);
const props = this.getPopoverProps(date, records)
- props['records'] = stress_days_data.concat(props['records'])
- this.stressDayPopover.open(target, props, "o_cw_popover");
+ props['records'] = mandatory_days_data.concat(props['records'])
+ this.mandatoryDayPopover.open(target, props, "o_cw_popover");
}
else {
super.onDateClick(info);
@@ -66,6 +66,6 @@ export class TimeOffCalendarYearRenderer extends CalendarYearRenderer {
onDayRender(info) {
super.onDayRender(info);
- this.stressDaysList = this.stressDays(info);
+ this.mandatoryDaysList = this.mandatoryDays(info);
}
}
diff --git a/addons/hr_holidays/static/src/views/hooks.js b/addons/hr_holidays/static/src/views/hooks.js
index 1bb18204b54..2ee275137b5 100644
--- a/addons/hr_holidays/static/src/views/hooks.js
+++ b/addons/hr_holidays/static/src/views/hooks.js
@@ -4,21 +4,21 @@ import { useService } from "@web/core/utils/hooks";
const { useEnv } = owl;
-export function useStressDays(props) {
+export function useMandatoryDays(props) {
return (info) => {
const date = luxon.DateTime.fromJSDate(info.date).toISODate();
- const stressDay = props.model.stressDays[date];
- if (stressDay) {
+ const mandatoryDay = props.model.mandatoryDays[date];
+ if (mandatoryDay) {
const dayNumberElTop = info.view.el.querySelector(`.fc-day-top[data-date="${info.el.dataset.date }"]`)
const dayNumberEl = info.view.el.querySelector(`.fc-day[data-date="${info.el.dataset.date }"]`)
if (dayNumberElTop) {
- dayNumberElTop.classList.add(`hr_stress_day_top_${stressDay}`);
+ dayNumberElTop.classList.add(`hr_mandatory_day_top_${mandatoryDay}`);
}
if (dayNumberEl) {
- dayNumberEl.classList.add(`hr_stress_day_${stressDay}`);
+ dayNumberEl.classList.add(`hr_mandatory_day_${mandatoryDay}`);
}
}
- return props.model.stressDays;
+ return props.model.mandatoryDays;
}
}
diff --git a/addons/hr_holidays/tests/__init__.py b/addons/hr_holidays/tests/__init__.py
index e9c0bc4e37a..bdb693bf38a 100644
--- a/addons/hr_holidays/tests/__init__.py
+++ b/addons/hr_holidays/tests/__init__.py
@@ -14,7 +14,7 @@ from . import test_leave_requests
from . import test_out_of_office
from . import test_company_leave
from . import test_res_partner
-from . import test_stress_days
+from . import test_mandatory_days
from . import test_global_leaves
from . import test_uninstall
from . import test_holidays_calendar
diff --git a/addons/hr_holidays/tests/test_access_rights.py b/addons/hr_holidays/tests/test_access_rights.py
index 7db64df1838..d3a43b59f13 100644
--- a/addons/hr_holidays/tests/test_access_rights.py
+++ b/addons/hr_holidays/tests/test_access_rights.py
@@ -71,8 +71,8 @@ class TestHrHolidaysAccessRightsCommon(TestHrHolidaysCommon):
]
# Here we only test access rights, prevent any conflict with
- # existing stress days - they are tested someplace else.
- cls.env['hr.leave.stress.day'].search([]).unlink()
+ # existing mandatory days - they are tested someplace else.
+ cls.env['hr.leave.mandatory.day'].search([]).unlink()
def request_leave(self, user_id, date_from, number_of_days, values=None):
values = dict(values or {}, **{
diff --git a/addons/hr_holidays/tests/test_stress_days.py b/addons/hr_holidays/tests/test_mandatory_days.py
similarity index 86%
rename from addons/hr_holidays/tests/test_stress_days.py
rename to addons/hr_holidays/tests/test_mandatory_days.py
index 410c24af2c3..152b7144399 100644
--- a/addons/hr_holidays/tests/test_stress_days.py
+++ b/addons/hr_holidays/tests/test_mandatory_days.py
@@ -11,7 +11,7 @@ from odoo.exceptions import ValidationError
@tests.tagged('access_rights', 'post_install', '-at_install')
-class TestHrLeaveStressDays(TransactionCase):
+class TestHrLeaveMandatoryDays(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@@ -47,7 +47,7 @@ class TestHrLeaveStressDays(TransactionCase):
'company_id': cls.company.id,
})
- cls.stress_day = cls.env['hr.leave.stress.day'].create({
+ cls.mandatory_day = cls.env['hr.leave.mandatory.day'].create({
'name': 'Super Event',
'company_id': cls.company.id,
'start_date': datetime(2021, 11, 2),
@@ -55,7 +55,7 @@ class TestHrLeaveStressDays(TransactionCase):
'color': 1,
'resource_calendar_id': cls.default_calendar.id,
})
- cls.stress_week = cls.env['hr.leave.stress.day'].create({
+ cls.mandatory_week = cls.env['hr.leave.mandatory.day'].create({
'name': 'Super Event End Of Week',
'company_id': cls.company.id,
'start_date': datetime(2021, 11, 8),
@@ -65,8 +65,8 @@ class TestHrLeaveStressDays(TransactionCase):
})
@freeze_time('2021-10-15')
- def test_request_stress_days(self):
- # An employee can request time off outside stress days
+ def test_request_mandatory_days(self):
+ # An employee can request time off outside mandatory days
self.env['hr.leave'].with_user(self.employee_user.id).create({
'name': 'coucou',
'holiday_status_id': self.leave_type.id,
@@ -76,7 +76,7 @@ class TestHrLeaveStressDays(TransactionCase):
'number_of_days': 1,
})
- # Taking a time off during a Stress Day is not allowed for a simple employee...
+ # Taking a time off during a Mandatory Day is not allowed for a simple employee...
with self.assertRaises(ValidationError):
self.env['hr.leave'].with_user(self.employee_user.id).create({
'name': 'coucou',
@@ -108,28 +108,28 @@ class TestHrLeaveStressDays(TransactionCase):
})
@freeze_time('2021-10-15')
- def test_get_stress_days(self):
- stress_days = self.employee_emp.get_stress_days('2021-11-01', '2021-11-30')
+ def test_get_mandatory_days(self):
+ mandatory_days = self.employee_emp.get_mandatory_days('2021-11-01', '2021-11-30')
- # Stress Days spanning multiple days should be split in single days
+ # Mandatory Days spanning multiple days should be split in single days
expected_data = {'2021-11-02': 1, '2021-11-08': 2, '2021-11-09': 2, '2021-11-10': 2, '2021-11-11': 2, '2021-11-12': 2}
- self.assertEqual(len(stress_days), len(expected_data))
+ self.assertEqual(len(mandatory_days), len(expected_data))
for day, color in expected_data.items():
- self.assertTrue(day in stress_days)
- self.assertEqual(color, stress_days[day])
+ self.assertTrue(day in mandatory_days)
+ self.assertEqual(color, mandatory_days[day])
with self.assertRaises(ValidationError), Form(self.env['hr.leave'].with_user(self.employee_user.id).with_context(default_employee_id=self.employee_emp.id)) as leave_form:
leave_form.holiday_status_id = self.leave_type
leave_form.request_date_from = datetime(2021, 11, 1)
leave_form.request_date_to = datetime(2021, 11, 1)
- self.assertFalse(leave_form.has_stress_day)
+ self.assertFalse(leave_form.has_mandatory_day)
leave_form.request_date_to = datetime(2021, 11, 5)
- self.assertTrue(leave_form.has_stress_day)
+ self.assertTrue(leave_form.has_mandatory_day)
@freeze_time('2021-10-15')
- def test_department_stress_days(self):
+ def test_department_mandatory_days(self):
production_department = self.env['hr.department'].create({
'name': 'Production Department',
'company_id': self.company.id,
@@ -149,8 +149,8 @@ class TestHrLeaveStressDays(TransactionCase):
'department_id': post_production_department.id
})
- # Create one stress day for each department
- self.env['hr.leave.stress.day'].create({
+ # Create one mandatory day for each department
+ self.env['hr.leave.mandatory.day'].create({
'name': 'Last Rush Before Launch (production)',
'company_id': self.company.id,
'start_date': datetime(2021, 11, 3),
@@ -159,7 +159,7 @@ class TestHrLeaveStressDays(TransactionCase):
'resource_calendar_id': self.default_calendar.id,
'department_ids': [production_department.id],
})
- self.env['hr.leave.stress.day'].create({
+ self.env['hr.leave.mandatory.day'].create({
'name': 'Last Rush Before Launch (post-production)',
'company_id': self.company.id,
'start_date': datetime(2021, 11, 4),
@@ -168,7 +168,7 @@ class TestHrLeaveStressDays(TransactionCase):
'resource_calendar_id': self.default_calendar.id,
'department_ids': [post_production_department.id],
})
- self.env['hr.leave.stress.day'].create({
+ self.env['hr.leave.mandatory.day'].create({
'name': 'Last Rush Before Launch (deployment)',
'company_id': self.company.id,
'start_date': datetime(2021, 11, 5),
@@ -178,7 +178,7 @@ class TestHrLeaveStressDays(TransactionCase):
'department_ids': [deployment_department.id],
})
- # The employee should only be able to create a time off on stress days
+ # The employee should only be able to create a time off on mandatory days
# that do not include his department
with self.assertRaises(ValidationError):
self.env['hr.leave'].with_user(self.employee_user.id).create({
diff --git a/addons/hr_holidays/views/hr_holidays_views.xml b/addons/hr_holidays/views/hr_holidays_views.xml
index 8d729ec97ed..3eda688ca33 100644
--- a/addons/hr_holidays/views/hr_holidays_views.xml
+++ b/addons/hr_holidays/views/hr_holidays_views.xml
@@ -10,7 +10,7 @@
@@ -41,8 +41,8 @@
action="action_hr_holidays_dashboard"/>
@@ -50,14 +50,14 @@
@@ -114,9 +114,9 @@
sequence="3"/>
diff --git a/addons/hr_holidays/views/hr_leave_accrual_views.xml b/addons/hr_holidays/views/hr_leave_accrual_views.xml
index a690ec84bc4..f27a12e74d8 100644
--- a/addons/hr_holidays/views/hr_leave_accrual_views.xml
+++ b/addons/hr_holidays/views/hr_leave_accrual_views.xml
@@ -25,7 +25,7 @@