diff --git a/__terp__.py b/__terp__.py index a12e65e..7abf30d 100644 --- a/__terp__.py +++ b/__terp__.py @@ -66,6 +66,7 @@ 'poweremail_mailbox_view.xml', 'poweremail_serveraction_view.xml', 'security/ir.model.access.csv', + 'poweremail_mailbox_cronjobs.xml' ], "installable": True, "active": False, diff --git a/migrations/5.0.24.5.0/post-0001_cron_rencuar_emails.py b/migrations/5.0.24.5.0/post-0001_cron_rencuar_emails.py new file mode 100644 index 0000000..62f79a5 --- /dev/null +++ b/migrations/5.0.24.5.0/post-0001_cron_rencuar_emails.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +import logging +from oopgrade.oopgrade import load_data + + +def up(cursor, installed_version): + if not installed_version: + return + + logger = logging.getLogger('openerp.migration') + + ##UPATAR UN XML SENCER## + logger.info("Updating XML poweremail_mailbox_cronjobs.xml") + load_data( + cursor, 'poweremail', 'poweremail_mailbox_cronjobs.xml', idref=None, mode='update' + ) + logger.info("XMLs succesfully updated.") + + +def down(cursor, installed_version): + pass + + +migrate = up \ No newline at end of file diff --git a/poweremail_mailbox.py b/poweremail_mailbox.py index 16e0e0d..7d22b7d 100644 --- a/poweremail_mailbox.py +++ b/poweremail_mailbox.py @@ -516,6 +516,19 @@ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, return super(osv.osv, self).search(cr, uid, args, offset, limit, order, context=context, count=count) + def _cronjob_resend_emails_error(self, cursor, uid, context=None): + if context is None: + context = {} + + emails_ids = self.search(cursor, uid, [ + ('history', 'like', '%None%'), + ('folder', '=', 'error') + ], context=context) + + self.write(cursor, uid, emails_ids, {'state': 'na', 'folder': 'outbox'}, context=context) + self.historise(cursor, uid, emails_ids, _("Email will be sent again"), context=context) + + PoweremailMailbox() diff --git a/poweremail_mailbox_cronjobs.xml b/poweremail_mailbox_cronjobs.xml new file mode 100644 index 0000000..484b5cd --- /dev/null +++ b/poweremail_mailbox_cronjobs.xml @@ -0,0 +1,19 @@ + + + + + + Reenviar emails amb error + + + 1 + days + -1 + + + + + + + +