'This method will be called by cron services to get translations from
Gengo. It will read translated terms and comments from Gengo and will
update respective ir.translation in Odoo.'

@api.model
def _sync_response(self, limit=GENGO_DEFAULT_LIMIT):

    IrTranslation = self.env['ir.translation']
    (flag, gengo) = self.gengo_authentication()
    if (not flag):
        _logger.warning('%s', gengo)
    else:
        offset = 0
        all_translation_ids = IrTranslation.search([('state', '=', 'inprogress'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('order_id', '!=', False)])
        while True:
            translation_ids = all_translation_ids[offset:(offset + limit)]
            offset += limit
            if (not translation_ids):
                break
            terms_progress = {'gengo_order_ids': set(), 'ir_translation_ids': set()}
            for term in translation_ids:
                terms_progress['gengo_order_ids'].add(term.order_id)
                terms_progress['ir_translation_ids'].add(tools.ustr(term.id))
            for order_id in terms_progress['gengo_order_ids']:
                order_response = gengo.getTranslationOrderJobs(id=order_id)
                jobs_approved = order_response.get('response', []).get('order', []).get('jobs_approved', [])
                gengo_ids = ','.join(jobs_approved)
            if gengo_ids:
                try:
                    job_response = gengo.getTranslationJobBatch(id=gengo_ids)
                except:
                    continue
                if (job_response['opstat'] == 'ok'):
                    for job in job_response['response'].get('jobs', []):
                        if (job.get('custom_data') in terms_progress['ir_translation_ids']):
                            self._update_terms_job(job)
    return True
