mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 04:52:01 +02:00
19.0 vanilla
This commit is contained in:
parent
e1d89e11e3
commit
a1f02d8cc7
225 changed files with 2335 additions and 775 deletions
|
|
@ -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) =>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue