summaryrefslogtreecommitdiff
path: root/addons/mail/wizard
diff options
context:
space:
mode:
authordht-odoo <dht@odoo.com>2021-03-19 10:43:00 +0000
committerThibault Delavallée <tde@odoo.com>2021-04-13 12:14:29 +0000
commite5880130c1534217c5bae905af8e5a040f40a819 (patch)
treeab6c18d0161efa419cd885d3fcac109f169e76e9 /addons/mail/wizard
parenta2985f32afeeca992bfd46c792549239935f2128 (diff)
[FIX] {test_}mail: properly handle deletion of mail notif from composer
Before this commit: When someone sends mail with help of mail_composer(mail.compose.message) without having a mail template set, mail is not deleted after being sent (and causes unwanted/unexpected burden on DB). This bug was introduced with commit[1], where auto deletion was disabled if template is not set on the composer. After this commit: If there is no mail template set on the composer, or if the template is set and 'auto_delete' is enabled on that template, the mail sent from composer will be deleted after being sent successfully. A context key is added to allow controlling this behavior. It is notably use to check query counters differences. commit[1] - https://github.com/odoo/odoo/commit/8a026e26c6ae25e3fdb5369a7fa3343d70fab782#diff-898a3d5c08a567c1a7b82c026a213d796e850e376cbdb1c9e7936409f440d37aR257 Task id: 2484915 PR odoo/odoo#68870 Original Pr #68403 X-original-commit: 05ad6c477f7da2a495e5baf5b4629323b9d11fa0 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mail/wizard')
-rw-r--r--addons/mail/wizard/mail_compose_message.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index b71a6fe8a74..517a797fc80 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -246,7 +246,7 @@ class MailComposer(models.TransientModel):
subtype_id=subtype_id,
email_layout_xmlid=notif_layout,
add_sign=not bool(wizard.template_id),
- mail_auto_delete=wizard.template_id.auto_delete if wizard.template_id else False,
+ mail_auto_delete=wizard.template_id.auto_delete if wizard.template_id else self._context.get('mail_auto_delete', True),
model_description=model_description)
post_params.update(mail_values)
if ActiveModel._name == 'mail.thread':