~akretion-team/+junk/connector-dev

« back to all changes in this revision

Viewing changes to connector_dev/queue.py

  • Committer: David Béal
  • Date: 2013-12-06 12:56:23 UTC
  • Revision ID: david.beal@akretion.com-20131206125623-75n3a4rjb8jyc9wr
[IMP] add 'clean failed jobs' button

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from openerp.addons.connector.session import ConnectorSession
25
25
 
26
26
 
 
27
 
27
28
class QueueJob(orm.Model):
28
29
    _inherit = 'queue.job'
29
30
 
37
38
        return True
38
39
 
39
40
    def run_queue_job_cron(self, cr, uid, ids, context=None):
40
 
        cron_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'connector', 'ir_cron_enqueue_jobs')[1]
 
41
        cron_id = self.pool['ir.model.data'].get_object_reference(
 
42
            cr, uid, 'connector', 'ir_cron_enqueue_jobs')[1]
41
43
        self.pool['ir.cron'].run_manually(cr, uid, [cron_id], context=context)
42
 
        return True
 
 
b'\\ No newline at end of file'
 
44
        return True
 
45
 
 
46
    def delete_failed_jobs(self, cr, uid, ids, context=None):
 
47
        job_ids = self.search(
 
48
            cr, uid, [('state', '=', 'failed')], context=context)
 
49
        self.unlink(cr, uid, job_ids, context=context)