Files
odoo_source/addons/mass_mailing/tests
jorv 5d469f67f1 [FIX] mass_mailing: precompute email_from based on alias domain
With 17.0 the `mail.alias.domain` was introduced, allowing the
configuration of the bounce, catchall and default from email addresses
at the company level (`res_company`).

For this purpose, the `_compute_email_from` method was introduced to correctly
compute the `email_from` in various email contexts.

But, the `email_from` field in mass_mailing was using an obsolete combination
of `default=` and a compute method.
This meant that when one created a new `mailing.mailing` record, it was
always defaulting to `self.env.user.email_formatted`.
The compute was only triggered when the `mail_server_id` field manually
updated.

This is corrected with this fix and a unit test was added to test three
different use cases.
An invisible `create_uid` was added to the base mailing From view xml
to have the compute method trigger correctly in some unit tests.

How to reproduce bug:
See related github issue https://github.com/odoo/odoo/issues/151310

Behavior after this fix:
If `mail.alias.domain` is setup for the company and a default `ir.mail_server`
is configured for Email Marketing, `_compute_email_from` will select
the expected `email_from` at record creation for `mailing.mailing`.

opw-3704715
Fixes #151310

commit 4b5453d87498d32b0ec3e3e7d64d35f903ac2193
Author: jorv <jorv@odoo.com>
Date:   Mon Mar 18 15:30:06 2024 +0100

[FIX] mass_mailing: precompute email_from based on alias domain

With 17.0 the `mail.alias.domain` was introduced, allowing the
configuration of the bounce, catchall and default from email addresses
at the company level (`res_company`).

For this purpose, the `_compute_email_from` method was introduced to correctly
compute the `email_from` in various email contexts.

But, the `email_from` field in mass_mailing was using an obsolete combination
of `default=` and a compute method.
This meant that when one created a new `mailing.mailing` record, it was
always defaulting to `self.env.user.email_formatted`.
The compute was only triggered when the `mail_server_id` field manually
updated.

This is corrected with this fix and a unit test was added to test three
different use cases.
An invisible `create_uid` was added to the base mailing From view xml
to have the compute method trigger correctly in some unit tests.

How to reproduce bug:
See related github issue https://github.com/odoo/odoo/issues/151310

Behavior after this fix:
If `mail.alias.domain` is setup for the company and a default `ir.mail_server`
is configured for Email Marketing, `_compute_email_from` will select
the expected `email_from` at record creation for `mailing.mailing`.

opw-3704715
Fixes #151310

closes odoo/odoo#152655

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-03-20 13:52:17 +00:00
..
…