[FIX] mail: revert the unlink in batch of the <mail.mail>
Bug === The unlink of the <mail.mail> in the CRON is problematic because we accumulate a lot of records, and the CRON timeout. In particular, when we sent a mailing, we receive the "opened" event (blank image in the email), and so we need to update the mailing trace. But, if we unlink the mail at the same time, it locked the mailing trace table and we couldn't write the new value. The reason for that is that before, the unlink took more queries, but it was done one record at a time, so we could commit the change and release the lock between each unlink. Task-3179157 See odoo/odoo/pull/73271 closes odoo/odoo#112331 Related: odoo/upgrade#4320 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -84,8 +84,6 @@ class MailMail(models.Model):
|
||||
auto_delete = fields.Boolean(
|
||||
'Auto Delete',
|
||||
help="This option permanently removes any track of email after it's been sent, including from the Technical menu in the Settings, in order to preserve storage space of your Odoo database.")
|
||||
# Unused since v16, to remove in master.
|
||||
to_delete = fields.Boolean('To Delete', help='If set, the mail will be deleted during the next Email Queue CRON run.')
|
||||
scheduled_date = fields.Datetime('Scheduled Send Date',
|
||||
help="If set, the queue manager will send the email after the date. If not set, the email will be send as soon as possible. Unless a timezone is specified, it is considered as being in UTC timezone.")
|
||||
fetchmail_server_id = fields.Many2one('fetchmail.server', "Inbound Mail Server", readonly=True)
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
<group string="Status">
|
||||
<field name="auto_delete"
|
||||
attrs="{'invisible': [('state', '!=', 'outgoing'), ('state', '!=', 'exception')]}"/>
|
||||
<field name="to_delete" invisible="1"/>
|
||||
<field name="is_notification"/>
|
||||
<field name="message_type"/>
|
||||
<field name="mail_server_id"/>
|
||||
@@ -98,7 +97,6 @@
|
||||
<field name="message_type" invisible="1"/>
|
||||
<field name="state" widget="badge" decoration-muted="state in ('sent', 'cancel')"
|
||||
decoration-info="state=='outgoing'" decoration-danger="state=='exception'"/>
|
||||
<field name="to_delete" invisible="1"/>
|
||||
<button name="send" string="Send Now" type="object" icon="fa-paper-plane" states='outgoing'/>
|
||||
<button name="mark_outgoing" string="Retry" type="object" icon="fa-repeat" states='exception,cancel'/>
|
||||
<button name="cancel" string="Cancel Email" type="object" icon="fa-times-circle" states='outgoing'/>
|
||||
|
||||
@@ -81,7 +81,7 @@ class TestMailPerformance(BaseMailPerformance):
|
||||
record_ticket = self.env['mail.test.ticket.mc'].browse(self.record_ticket.ids)
|
||||
attachments = self.env['ir.attachment'].create(self.test_attachments_vals)
|
||||
|
||||
with self.assertQueryCount(employee=91): # tmf: 90
|
||||
with self.assertQueryCount(employee=86): # tmf: 85
|
||||
new_message = record_ticket.message_post(
|
||||
attachment_ids=attachments.ids,
|
||||
body='<p>Test Content</p>',
|
||||
|
||||
Reference in New Issue
Block a user