diff options
| author | Parth Gajjar (Open ERP) <pga@tinyerp.com> | 2014-03-19 19:01:21 +0530 |
|---|---|---|
| committer | Parth Gajjar (Open ERP) <pga@tinyerp.com> | 2014-03-19 19:01:21 +0530 |
| commit | b8d87606f0579bbdfdf75dee4669d5f0fd9bb279 (patch) | |
| tree | bd83a31d8c8ae4ddca632e49ae5674a89e6b581d /addons/website_gengo/controllers/main.py | |
| parent | c49befd59f5ab3ef50a061b29dcef36b55c79088 (diff) | |
[IMP] added gengo statistics, displayed inprogress elements
bzr revid: pga@tinyerp.com-20140319133121-31umju0ea84sm93y
Diffstat (limited to 'addons/website_gengo/controllers/main.py')
| -rw-r--r-- | addons/website_gengo/controllers/main.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/website_gengo/controllers/main.py b/addons/website_gengo/controllers/main.py index e69de29bb2d..167e3e7bd36 100644 --- a/addons/website_gengo/controllers/main.py +++ b/addons/website_gengo/controllers/main.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from openerp.addons.web import http +from openerp.addons.web.http import request +class website_gengo(http.Controller): + + @http.route('/website/get_gengo_info', type='json', auth='user', website=True) + def get_gengo_info(self, view_id, lang): + ir_translation_obj = request.registry['ir.translation'] + res_lang_obj = request.registry['res.lang'] + translation_ids = ir_translation_obj.search(request.cr, request.uid, [('res_id','=',view_id),('gengo_translation','!=', False),('lang','=',lang)]) + result={"total":0,"inprogess":0,"done":0} + for trans in ir_translation_obj.browse(request.cr, request.uid, translation_ids): + result['total'] += len(trans.source.split()) + if trans.state == 'translated': + result['done'] += len(trans.source.split()) + elif trans.state == 'inprogress': + result['inprogess'] += len(trans.source.split()) + return result |
