'Try to grab a dummy exclusive write-lock to the rows with the given ids,
to make sure a following write() or unlink() will not block due
to a process currently executing those cron tasks'

@api.multi
def _try_lock(self):

    try:
        self._cr.execute(('SELECT    id    FROM    "%s"    WHERE    id    IN    %%s    FOR    UPDATE    NOWAIT' % self._table), [tuple(self.ids)], log_exceptions=False)
    except psycopg2.OperationalError:
        self._cr.rollback()
        raise UserError(_('Record    cannot    be    modified    right    now:    This    cron    task    is    currently    being    executed    and    may    not    be    modified    Please    try    again    in    a    few    minutes'))
