diff --git a/addons/hr/static/src/core/web/thread_actions.js b/addons/hr/static/src/core/web/thread_actions.js index e5295cf0e99..8a7d313cbac 100644 --- a/addons/hr/static/src/core/web/thread_actions.js +++ b/addons/hr/static/src/core/web/thread_actions.js @@ -26,7 +26,6 @@ threadActionsRegistry.add("open-hr-profile", { async setup(action) { const component = useComponent(); const orm = useService("orm"); - const store = useService("mail.store"); let employeeId; if (!component.thread?.correspondent?.employeeId && component.thread?.chatPartner) { const employees = await orm.silent.searchRead( @@ -35,12 +34,9 @@ threadActionsRegistry.add("open-hr-profile", { ["id"] ); employeeId = employees[0]?.id; - } - if (employeeId) { - store.Persona.insert({ - ...component.thread.correspondent, - employeeId, - }); + if (employeeId) { + component.thread.chatPartner.employeeId = employeeId; + } } }, sequence: 16, diff --git a/addons/mail/static/src/core/common/store_service.js b/addons/mail/static/src/core/common/store_service.js index e24922ddd51..f0e808870fa 100644 --- a/addons/mail/static/src/core/common/store_service.js +++ b/addons/mail/static/src/core/common/store_service.js @@ -227,8 +227,11 @@ export const storeService = { for (const r2 of oldRecords) { r2.__invs__.delete(r1.localId, name); } + // l1 and collection could be same record list, + // save before clear to not push mutated recordlist that is empty + const col = [...collection]; l1.clear(); - l1.push(...collection); + l1.push(...col); } else { // [Record.one] = if (Record.isCommand(val)) {