diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 6d12f8a49fe..1be8a2b4796 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -656,6 +656,9 @@ class WebClient(openerpweb.Controller): def translations(self, req, mods, lang): res_lang = req.session.model('res.lang') ids = res_lang.search([("code", "=", lang)]) + if not ids: + ids = res_lang.search([("iso_code", "=", lang)]) + lang = res_lang.search_read([('id', "in", ids)], ["code"])[0]['code'] lang_params = None if ids: lang_params = res_lang.read(ids[0], ["direction", "date_format", "time_format", @@ -668,7 +671,7 @@ class WebClient(openerpweb.Controller): messages = ir_translation.search_read([('module','in',mods),('lang','=',lang), ('comments','like','openerp-web'),('value','!=',False), ('value','!=','')], - ['module','src','value','lang'], order='module') + ['module','src','value','lang'], order='module') for mod, msg_group in itertools.groupby(messages, key=operator.itemgetter('module')): translations_per_module.setdefault(mod,{'messages':[]}) translations_per_module[mod]['messages'].extend({'id': m['src'], @@ -1072,7 +1075,7 @@ class DataSet(openerpweb.Controller): @openerpweb.jsonrequest def call(self, req, model, method, args, domain_id=None, context_id=None): return self._call_kw(req, model, method, args, {}) - + @openerpweb.jsonrequest def call_kw(self, req, model, method, args, kwargs): return self._call_kw(req, model, method, args, kwargs) @@ -1186,7 +1189,7 @@ class Binary(openerpweb.Controller): if width > 500: width = 500 if height > 500: height = 500 image_base64 = openerp.tools.image_resize_image(base64_source=image_base64, size=(width, height), encoding='base64', filetype='PNG') - + image_data = base64.b64decode(image_base64) except (TypeError, xmlrpclib.Fault): @@ -1468,7 +1471,7 @@ class Export(View): fields = self.fields_get(req, model) if ".id" in export_fields: fields['.id'] = fields.pop('id', {'string': 'ID'}) - + # To make fields retrieval more efficient, fetch all sub-fields of a # given field at the same time. Because the order in the export list is # arbitrary, this requires ordering all sub-fields of a given field