- if term.job_id <> job.get('job_id'):
- raise 'Error'
- vals = {'state': 'translated', 'value': job.get('body_tgt')}
- translation_pool.write(cr, uid, [int(tid)], vals, context=context)
+ if term.src != job.get('body_src'):
+ return Response("Text Altered - Not saved", status=100)
+ domain = [
+ '|',
+ ('id', "=", int(tid)),
+ '&', '&', '&', '&', '&',
+ ('state', '=', term.state),
+ ('gengo_translation', '=', term.gengo_translation),
+ ('src', "=", term.src),
+ ('type', "=", term.type),
+ ('name', "=", term.name),
+ ('lang', "=", term.lang),
+ #('order_id', "=", term.order_id),
+ ]
+
+ all_ir_tanslations = translation_pool.search(cr, uid, domain, context=context or {})
+
+ if all_ir_tanslations:
+ vals = {'state': 'translated', 'value': job.get('body_tgt')}
+ translation_pool.write(cr, uid, all_ir_tanslations, vals, context=context)
+ return Response("OK", status=200)
+ else:
+ return Response("No terms found", status=104)
+ return Response("Not saved", status=100)