diff options
| author | P. Christeas <p_christ@hol.gr> | 2009-07-09 21:12:53 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2009-07-09 21:12:53 +0300 |
| commit | 2d64ce69d07a55f827548e43cfcc73cd459dc39a (patch) | |
| tree | b217b2afe155395280d27a4c6cc0c43c89396c3b /bin/tools | |
| parent | cb5e80507f5a8330ed4e0f2526343b97f8d506e6 (diff) | |
| parent | a2db1c09ba3a279a8d791c8914a19d2f0dbb2c18 (diff) | |
Merge origin/master into mdv-gpl3-py26
Conflicts:
bin/addons/base_setup/i18n/base_setup.pot
bin/openerp-server.py
bin/report/preprocess.py
bin/report/report_sxw.py
bin/tools/translate.py
bzr revid: p_christ@hol.gr-20090709181253-fu8nxy9b3ykrrd1c
Diffstat (limited to 'bin/tools')
| -rw-r--r-- | bin/tools/convert.py | 8 | ||||
| -rw-r--r-- | bin/tools/misc.py | 4 | ||||
| -rw-r--r-- | bin/tools/translate.py | 92 |
3 files changed, 56 insertions, 48 deletions
diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 18b1377047e..a57a3ee306f 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -261,10 +261,14 @@ form: module.record_id""" % (xml_id,) if len(d_search): ids = self.pool.get(d_model).search(cr,self.uid,eval(d_search)) if len(d_id): - ids.append(self.id_get(cr, d_model, d_id)) + try: + ids.append(self.id_get(cr, d_model, d_id)) + except: + # d_id cannot be found. doesn't matter in this case + pass if len(ids): self.pool.get(d_model).unlink(cr, self.uid, ids) - #self.pool.get('ir.model.data')._unlink(cr, self.uid, d_model, ids, direct=True) + self.pool.get('ir.model.data')._unlink(cr, self.uid, d_model, ids, direct=True) return False def _tag_report(self, cr, rec, data_node=None): diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 3f3dffc6faf..a8bbe6c9b7e 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -100,8 +100,8 @@ def init_db(cr): info.get('website', ''), i, info.get('name', False), info.get('description', ''), p_id, state, info.get('certificate'))) cr.execute('insert into ir_model_data \ - (name,model,module, res_id) values (%s,%s,%s,%s)', ( - 'module_meta_information', 'ir.module.module', i, id)) + (name,model,module, res_id, noupdate) values (%s,%s,%s,%s,%s)', ( + 'module_meta_information', 'ir.module.module', i, id, True)) dependencies = info.get('depends', []) for d in dependencies: cr.execute('insert into ir_module_module_dependency \ diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 93451115edc..98e0854c71d 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -24,7 +24,8 @@ import os from os.path import join import fnmatch import csv, xml.dom, re -import osv, tools, pooler +import tools, pooler +from osv.orm import BrowseRecordError import ir import netsvc from tools.misc import UpdateableStr @@ -454,54 +455,57 @@ def trans_generate(lang, modules, dbname=None): if not pool.get(model): logger.notifyChannel("db", netsvc.LOG_ERROR, "unable to find object %r" % (model,)) continue - obj = pool.get(model).browse(cr, uid, res_id) + + try: + obj = pool.get(model).browse(cr, uid, res_id) + except BrowseRecordError: + logger.notifyChannel("db", netsvc.LOG_ERROR, "unable to find object %r with id %d" % (model, res_id)) + continue + if model=='ir.ui.view': d = xml.dom.minidom.parseString(encode(obj.arch)) for t in trans_parse_view(d.documentElement): push_translation(module, 'view', encode(obj.model), 0, t) elif model=='ir.actions.wizard': service_name = 'wizard.'+encode(obj.wiz_name) - try: + if netsvc.SERVICES.get(service_name): obj2 = netsvc.SERVICES[service_name] - except KeyError, exc: - logger.notifyChannel("db", netsvc.LOG_ERROR, "key error in %s: %s" % (xml_name,str(exc))) - continue - for state_name, state_def in obj2.states.iteritems(): - if 'result' in state_def: - result = state_def['result'] - if result['type'] != 'form': - continue - name = "%s,%s" % (encode(obj.wiz_name), state_name) - - def_params = { - 'string': ('wizard_field', lambda s: [encode(s)]), - 'selection': ('selection', lambda s: [encode(e[1]) for e in ((not callable(s)) and s or [])] ), - 'help': ('help', lambda s: [encode(s)]), - } - - # export fields - for field_name, field_def in result['fields'].iteritems(): - res_name = name + ',' + field_name - - for fn in def_params: - if fn in field_def: - transtype, modifier = def_params[fn] - for val in modifier(field_def[fn]): - push_translation(module, transtype, res_name, 0, val) - - # export arch - arch = result['arch'] - if arch and not isinstance(arch, UpdateableStr): - d = xml.dom.minidom.parseString(arch) - for t in trans_parse_view(d.documentElement): - push_translation(module, 'wizard_view', name, 0, t) - - # export button labels - for but_args in result['state']: - button_name = but_args[0] - button_label = but_args[1] - res_name = name + ',' + button_name - push_translation(module, 'wizard_button', res_name, 0, button_label) + for state_name, state_def in obj2.states.iteritems(): + if 'result' in state_def: + result = state_def['result'] + if result['type'] != 'form': + continue + name = "%s,%s" % (encode(obj.wiz_name), state_name) + + def_params = { + 'string': ('wizard_field', lambda s: [encode(s)]), + 'selection': ('selection', lambda s: [encode(e[1]) for e in ((not callable(s)) and s or [])]), + 'help': ('help', lambda s: [encode(s)]), + } + + # export fields + for field_name, field_def in result['fields'].iteritems(): + res_name = name + ',' + field_name + + for fn in def_params: + if fn in field_def: + transtype, modifier = def_params[fn] + for val in modifier(field_def[fn]): + push_translation(module, transtype, res_name, 0, val) + + # export arch + arch = result['arch'] + if arch and not isinstance(arch, UpdateableStr): + d = xml.dom.minidom.parseString(arch) + for t in trans_parse_view(d.documentElement): + push_translation(module, 'wizard_view', name, 0, t) + + # export button labels + for but_args in result['state']: + button_name = but_args[0] + button_label = but_args[1] + res_name = name + ',' + button_name + push_translation(module, 'wizard_button', res_name, 0, button_label) elif model=='ir.model.fields': try: @@ -699,8 +703,8 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name= for row in reader: line += 1 # skip empty rows and rows where the translation field (=last fiefd) is empty - if (not row) or (not row[-1]): - continue + #if (not row) or (not row[-1]): + # continue # dictionary which holds values for this line of the csv file # {'lang': ..., 'type': ..., 'name': ..., 'res_id': ..., |
