19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-25 12:00:11 +01:00
parent e1d89e11e3
commit a1f02d8cc7
225 changed files with 2335 additions and 775 deletions

View file

@ -42,9 +42,13 @@ export class WorkEntryCalendarModel extends CalendarModel {
}
);
if (userFavoritesWorkEntriesIds.length) {
const typeIds = userFavoritesWorkEntriesIds
.map((r) => r.work_entry_type_id?.[0])
.filter(Boolean);
const uniqueTypeIds = [...new Set(typeIds)];
this.userFavoritesWorkEntries = await this.orm.read(
"hr.work.entry.type",
userFavoritesWorkEntriesIds.map((r) => r.work_entry_type_id?.[0]).filter(Boolean),
uniqueTypeIds,
["display_name", "display_code", "color"]
);
this.userFavoritesWorkEntries = this.userFavoritesWorkEntries.sort((a, b) =>

View file

@ -77,3 +77,39 @@ test("should use default_employee_id from context in work entry", async () => {
work_entry_type_id: workEntryTypeId,
});
});
test("calendar multi-selection quick buttons deduplicate favorites", async () => {
const { env } = await makeMockServer();
const [type] = env["hr.work.entry.type"].create([
{
name: "MyType",
},
]);
env["hr.work.entry"].create([
{
name: "e1",
employee_id: 100,
work_entry_type_id: type,
date: "2025-01-01",
create_date: "2025-01-01",
},
{
name: "e2",
employee_id: 100,
work_entry_type_id: type,
date: "2025-01-02",
create_date: "2025-01-02",
},
]);
const calendar = await mountView({
type: "calendar",
resModel: "hr.work.entry",
});
const controller = getCalendarController(calendar);
await controller.model._fetchUserFavoritesWorkEntries();
//ensure favorites deduplication happened
expect(controller.model.userFavoritesWorkEntries).toHaveLength(1, {
message: "calendar model favorites list must contain just one type",
});
});