[FIX] mail: use ids parameter in the process_mail_queue method
If the parameter ids is given to the process_mail_queue method, it is supposed to only process the ids it was given, not all mails. Commit https://github.com/odoo/odoo/commit/4b122ad41d873febe288ab1f8c6cdc078ca2a479 replaced ids by self.ids, and thus default filter was always applied. fix suggested by @suganthikarunanithi, Sodexis team opw 1860484
This commit is contained in:
@@ -104,16 +104,19 @@ class MailMail(models.Model):
|
||||
messages to send (by default all 'outgoing'
|
||||
messages are sent).
|
||||
"""
|
||||
if not self.ids:
|
||||
filters = ['&',
|
||||
('state', '=', 'outgoing'),
|
||||
'|',
|
||||
('scheduled_date', '<', datetime.datetime.now()),
|
||||
('scheduled_date', '=', False)]
|
||||
if 'filters' in self._context:
|
||||
filters.extend(self._context['filters'])
|
||||
# TODO: make limit configurable
|
||||
ids = self.search(filters, limit=10000).ids
|
||||
filters = ['&',
|
||||
('state', '=', 'outgoing'),
|
||||
'|',
|
||||
('scheduled_date', '<', datetime.datetime.now()),
|
||||
('scheduled_date', '=', False)]
|
||||
if 'filters' in self._context:
|
||||
filters.extend(self._context['filters'])
|
||||
# TODO: make limit configurable
|
||||
filtered_ids = self.search(filters, limit=10000).ids
|
||||
if not ids:
|
||||
ids = filtered_ids
|
||||
else:
|
||||
ids = list(set(filtered_ids) & set(ids))
|
||||
res = None
|
||||
try:
|
||||
# auto-commit except in testing mode
|
||||
|
||||
Reference in New Issue
Block a user