commit
725a31135e
|
@ -3424,6 +3424,7 @@ msgstr "Configuration de l'action client"
|
|||
#. module: base
|
||||
#: model:ir.actions.act_window,name:base.action_partner_address_form
|
||||
#: model:ir.model,name:base.model_res_partner_address
|
||||
#: model:ir.ui.menu,name:base.menu_partner_address_form
|
||||
#: view:res.partner.address:0
|
||||
msgid "Partner Addresses"
|
||||
msgstr "Adresses des Partenaires"
|
||||
|
|
|
@ -928,7 +928,7 @@
|
|||
<field name="res_model">ir.translation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_translation_tree"/>
|
||||
<field name="domain">[('value', '=', False)]</field>
|
||||
<field name="domain">['|',('value', '=', False),('value','=','')]</field>
|
||||
</record>
|
||||
<menuitem action="action_translation_untrans" id="menu_action_translation_untrans" parent="menu_action_translation"/>
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ class ir_ui_menu(osv.osv):
|
|||
'complete_name': fields.function(_get_full_name, method=True,
|
||||
string='Complete Name', type='char', size=128),
|
||||
'icon': fields.selection(tools.icons, 'Icon', size=64),
|
||||
'icon_pict': fields.function(_get_icon_pict, method=True, type='picture'),
|
||||
'icon_pict': fields.function(_get_icon_pict, method=True, type='char', size=32),
|
||||
'action': fields.function(_action, fnct_inv=_action_inv,
|
||||
method=True, type='reference', string='Action',
|
||||
selection=[
|
||||
|
|
|
@ -311,6 +311,9 @@
|
|||
<rng:element name="properties"><rng:empty/></rng:element>
|
||||
<rng:element name="newline"><rng:empty/></rng:element>
|
||||
<rng:ref name="image"/>
|
||||
<rng:ref name="notebook"/>
|
||||
<rng:ref name="hpaned"/>
|
||||
<rng:ref name="vpaned"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<rng:optional><rng:attribute name="menu"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="keyword"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="rml"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="sxw"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="xml"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="xsl"/></rng:optional>
|
||||
<rng:optional> <rng:attribute name="auto" /> </rng:optional>
|
||||
|
|
|
@ -182,12 +182,15 @@ class browse_record(object):
|
|||
datas = self._table.read(self._cr, self._uid, ids, fffields, context=self._context, load="_classic_write")
|
||||
if self._fields_process:
|
||||
lang = self._context.get('lang', 'en_US') or 'en_US'
|
||||
lang_obj = self.pool.get('res.lang').browse(self._cr, self._uid,self.pool.get('res.lang').search(self._cr, self._uid,[('code','=',lang)])[0])
|
||||
lang_obj_ids = self.pool.get('res.lang').search(self._cr, self._uid,[('code','=',lang)])
|
||||
if not lang_obj_ids:
|
||||
raise Exception(_('Language with code "%s" is not defined in your system !\nDefine it through the Administration menu.') % (lang,))
|
||||
lang_obj = self.pool.get('res.lang').browse(self._cr, self._uid,lang_obj_ids[0])
|
||||
for n, f in ffields:
|
||||
if f._type in self._fields_process:
|
||||
for d in datas:
|
||||
d[n] = self._fields_process[f._type](d[n])
|
||||
if d[n]:
|
||||
if (d[n] is not None) and (d[n] is not False):
|
||||
d[n].set_value(self._cr, self._uid, d[n], self, f, lang_obj)
|
||||
|
||||
|
||||
|
|
|
@ -71,8 +71,24 @@ class html2html(object):
|
|||
self._node.remove(n)
|
||||
process_text(self.etree, self._node)
|
||||
return self._node
|
||||
|
||||
def url_modify(self,root):
|
||||
for n in root.getchildren():
|
||||
if (n.text.find('<a ')>=0 or n.text.find('<a')>=0) and n.text.find('href')>=0 and n.text.find('style')<=0 :
|
||||
node = (n.tag=='span' and n.getparent().tag=='u') and n.getparent().getparent() or ((n.tag=='span') and n.getparent()) or n
|
||||
style = node.get('color') and "style='color:%s; text-decoration: none;'"%node.get('color') or ''
|
||||
if n.text.find('<a')>=0:
|
||||
t = '<a '
|
||||
else :
|
||||
t = '<a '
|
||||
href = n.text.split(t)[-1]
|
||||
n.text = ' '.join([t,style,href])
|
||||
self.url_modify(n)
|
||||
return root
|
||||
|
||||
def parseString(node, localcontext = {}):
|
||||
r = html2html(node, localcontext)
|
||||
return r.render()
|
||||
root = r.render()
|
||||
root = r.url_modify(root)
|
||||
return root
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ import copy
|
|||
|
||||
_regex = re.compile('\[\[(.+?)\]\]')
|
||||
|
||||
def str2xml(s):
|
||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||
|
||||
def _child_get(node, self=None, tagname=None):
|
||||
for n in node:
|
||||
if self and self.localcontext and n.get('rml_loop', False):
|
||||
|
@ -100,13 +103,13 @@ def _process_text(self, txt):
|
|||
result += self.localcontext.get('translate', lambda x:x)(sps.pop(0))
|
||||
if sps:
|
||||
try:
|
||||
txt2 = eval(sps.pop(0),self.localcontext)
|
||||
txt2 = str2xml(eval(sps.pop(0),self.localcontext))
|
||||
except:
|
||||
txt2 = ''
|
||||
if type(txt2) == type(0) or type(txt2) == type(0.0):
|
||||
txt2 = str(txt2)
|
||||
if type(txt2)==type('') or type(txt2)==type(u''):
|
||||
result += txt2
|
||||
elif (txt2 is not None) and (txt2 is not False):
|
||||
result += str(txt2)
|
||||
return result
|
||||
|
||||
def text_get(node):
|
||||
|
|
|
@ -72,8 +72,6 @@ rml2sxw = {
|
|||
'para': 'p',
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _format(object):
|
||||
def set_value(self, cr, uid, name, object, field, lang_obj):
|
||||
self.object = object
|
||||
|
@ -82,15 +80,15 @@ class _format(object):
|
|||
self.lang_obj = lang_obj
|
||||
|
||||
class _float_format(float, _format):
|
||||
|
||||
def __init__(self,value):
|
||||
super(_float_format, self).__init__()
|
||||
self.val = value and str(value) or str(0.00)
|
||||
self.val = value
|
||||
|
||||
def __str__(self):
|
||||
digits = 2
|
||||
if hasattr(self,'_field') and hasattr(self._field, 'digits') and self._field.digits:
|
||||
digits = self._field.digits[1]
|
||||
if hasattr(self, 'lang_obj'):
|
||||
return self.lang_obj.format('%.' + str(digits) + 'f', self.name, True)
|
||||
return self.val
|
||||
|
||||
|
@ -217,14 +215,6 @@ class rml_parse(object):
|
|||
if not lang or self.default_lang.has_key(lang):
|
||||
if not lang:
|
||||
key = 'en_US'
|
||||
self.lang_dict_called = False
|
||||
self.localcontext['lang'] = lang
|
||||
elif self.default_lang.has_key(lang):
|
||||
key = lang
|
||||
if self.default_lang.get(key,False):
|
||||
self.lang_dict = self.default_lang.get(key,False).copy()
|
||||
self.lang_dict_called = True
|
||||
return True
|
||||
self.localcontext['lang'] = lang
|
||||
self.lang_dict_called = False
|
||||
for obj in self.objects:
|
||||
|
@ -523,6 +513,6 @@ class report_sxw(report_rml, preprocess.report):
|
|||
create_doc = self.generators['html2html']
|
||||
html = etree.tostring(create_doc(html_dom, html_parser.localcontext))
|
||||
|
||||
return (html.replace('<', '<').replace('>', '>').replace('</br>',''), report_type)
|
||||
return (html.replace('&','&').replace('<', '<').replace('>', '>').replace('</br>',''), report_type)
|
||||
|
||||
|
||||
|
|
|
@ -427,43 +427,44 @@ def trans_generate(lang, modules, dbname=None):
|
|||
push_translation(module, 'view', encode(obj.model), 0, t)
|
||||
elif model=='ir.actions.wizard':
|
||||
service_name = 'wizard.'+encode(obj.wiz_name)
|
||||
obj2 = netsvc.SERVICES[service_name]
|
||||
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)]),
|
||||
}
|
||||
if netsvc.SERVICES.get(service_name):
|
||||
obj2 = netsvc.SERVICES[service_name]
|
||||
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 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 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)
|
||||
# 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':
|
||||
field_name = encode(obj.name)
|
||||
|
@ -523,8 +524,11 @@ def trans_generate(lang, modules, dbname=None):
|
|||
for field_name,field_def in pool.get(model)._columns.items():
|
||||
if field_def.translate:
|
||||
name = model + "," + field_name
|
||||
trad = getattr(obj, field_name) or ''
|
||||
push_translation(module, 'model', name, xml_name, encode(trad))
|
||||
try:
|
||||
trad = getattr(obj, field_name) or ''
|
||||
push_translation(module, 'model', name, xml_name, encode(trad))
|
||||
except:
|
||||
pass
|
||||
|
||||
# parse source code for _() calls
|
||||
def get_module_from_path(path):
|
||||
|
@ -642,8 +646,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': ...,
|
||||
|
|
Loading…
Reference in New Issue