[FIX] mass_mailing: avoid clicks overriding reply trace state
Currently if someone replies to a mass mailing email, then performs a click on
tracked links, final trace status is set to opened. Indeed both reply and
click set the trace as opened, as replying or clicking imply opening the
mail.
Update is the following
* user replies -> set status to open, then set status to reply, and update
open_datetime and reply_datetime;
* user clicks -> set status to open, then update click_datetime;
In the end the trace is left as opened while it is replied, with a click
datetime attached to the trace. To avoid unnecessary status update, a trace
is set to opened only if it is not already opened or replied. Other statuses
should not override themselves.
Task-2692316
X-original-commit: ce88d364369c8b58256e8d93b7cb506a2c262a34
Part-of: odoo/odoo#79877
This commit is contained in:
@@ -131,8 +131,11 @@ class MailingTrace(models.Model):
|
||||
return traces
|
||||
|
||||
def set_opened(self, domain=None):
|
||||
""" Reply / Open are a bit shared in various processes: reply implies
|
||||
open, click implies open. Let us avoid status override by skipping traces
|
||||
that are not already opened or replied. """
|
||||
traces = self + (self.search(domain) if domain else self.env['mailing.trace'])
|
||||
traces.write({'trace_status': 'open', 'open_datetime': fields.Datetime.now()})
|
||||
traces.filtered(lambda t: t.trace_status not in ('open', 'reply')).write({'trace_status': 'open', 'open_datetime': fields.Datetime.now()})
|
||||
return traces
|
||||
|
||||
def set_clicked(self, domain=None):
|
||||
|
||||
Reference in New Issue
Block a user