summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/mail_mail.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-06-12 16:18:32 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-06-12 16:18:32 +0700
commit6616f73259c9e146449af3f2579263b42270bf8b (patch)
tree0dfebb75f458c738f63593313b0e19e917e85860 /indoteknik_custom/models/mail_mail.py
parentb6f63fcf96355bc11f9843a9f661cea0a458475e (diff)
Revert "<hafid> commit"
This reverts commit 95cef4d4d3936f8a612dadf00e83f9cddcccc0dc, reversing changes made to 626e93d3a0bfad2bc87002d9e0a7ae860ea9baba.
Diffstat (limited to 'indoteknik_custom/models/mail_mail.py')
-rw-r--r--indoteknik_custom/models/mail_mail.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/indoteknik_custom/models/mail_mail.py b/indoteknik_custom/models/mail_mail.py
index cbcd883a..82b1fcca 100644
--- a/indoteknik_custom/models/mail_mail.py
+++ b/indoteknik_custom/models/mail_mail.py
@@ -1,27 +1,12 @@
from odoo import fields, models, api, _
-from datetime import timedelta
-import logging
-_logger = logging.getLogger(__name__)
class MailMail(models.Model):
_inherit = 'mail.mail'
- @api.model
def retry_send_mail(self):
- now = fields.Datetime.now()
- seven_days_ago = now - timedelta(days=7)
-
- # Filter hanya email gagal dalam 7 hari terakhir
- mails = self.search([
- ('state', 'in', 'exception'),
- ('create_date', '>=', seven_days_ago),
- ('create_date', '<=', now),
+ mails = self.env['mail.mail'].search([
+ ('state', 'in', ['exception', 'cancel']),
], limit=250)
-
- _logger.info("Found %s failed emails in last 7 days to retry.", len(mails))
-
for mail in mails:
- _logger.info("Retrying email ID %s - To: %s - Subject: %s",
- mail.id, mail.email_to, mail.subject)
mail.state = 'outgoing'