Skip to content

[19.0][FIX] impersonate_login: stamp chatter messages on create - #1010

Open
astirpe wants to merge 1 commit into
OCA:19.0from
astirpe:19_imp_impersonate_login_1
Open

astirpe wants to merge 1 commit into
OCA:19.0from
astirpe:19_imp_impersonate_login_1

Conversation

@astirpe

@astirpe astirpe commented Sep 17, 2026

Copy link
Copy Markdown
Member

mail.message.body and impersonated_author_id are stored computed fields
depending on author_id, so any later write on author_id re-runs them
outside the context in which the message was written. The stamp is then
lost, or the "Logged in as ..." notice is added a second time.

Both values are now set in create(), which also removes the body field
override and a compute that fired on every mail.message in the database.

Steps to reproduce (stamp erased):

  1. As admin, Switch Login to another user.
  2. Post a message in the chatter of any contact. The body starts with
    "Logged in as " and impersonated_author_id is the admin partner.
  3. Go back to the original user and change the author of that message,
    for instance by merging the author partner into another contact.
  4. impersonated_author_id is now empty, while the notice stays in the
    body: the record no longer says who was really behind the keyboard.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @Kev-Roche,
some modules you are maintaining are being modified, check this out!

@astirpe
astirpe marked this pull request as ready for review September 17, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:impersonate_login Module impersonate_login series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants